As you can see in this log, thread 100505 sends restart signal to
thread 100430 *BEFORE* thread 100430 has started poll() kernel call.
Then thread 100430 is stuck in poll() with nobody to restart it.
If I hit ^Z, poll is interrupted, then "fg" makes it progress. By
doing this a couple of times I managed to make test_socket finish.
Alternatively, I patched glibc with this workaround (see attachment).
This makes the test finish in about 16 seconds.
Going back to the race between thr_kill() and poll(), any idea what
could be causing this? To begin with I don't even know how to get a
backtrace for the relevant calls :-/