| Summary: | pthread_kill does not always work | ||
|---|---|---|---|
| Product: | Base System | Reporter: | mark <mark> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 3.2-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
} >How-To-Repeat: } } Sorry, no sample code. I have hacked up the application to the } point that it is no longer recognizeable. This duplicated kern/11984. This simple code is in there. } >Fix: } } pthread_kill probably needs to know how to kill processes that } are waiting for file locks. The problem is that libc_r does not provide a flag to tell thread kernel if any thread is being killing, so that if the killed thread is in dead loop status or some locked status, then program will hang or wait forever. -Jin State Changed From-To: open->closed The problem has been fixed on both -current and -stable. |
I wrote an application that worked basically like this: main: create a socket create 10 threads run for a while, then: send each thread a signal with pthread_kill and wait for it in pthread_join. when one thread has been waited for, go back and kill the next one exit Each thread (in a loop): does an accept on the socket copies some data closes the data socket repeats The problem: Waiting in pthread_join was not fruitful. Examination shows that *most* of the threads that are in 'accept' were waiting for the a lock on the socket (state: PS_FDLR_WAIT) and pthread_kill does not do anything to them. One lucky thread would be in PS_FDR_WAIT, and it could be killed... but it is hard for my application to know which thread that is. Fix: pthread_kill probably needs to know how to kill processes that are waiting for file locks. How-To-Repeat: Sorry, no sample code. I have hacked up the application to the point that it is no longer recognizeable.