Date: Fri, 22 Sep 2006 14:47:06 -0400 (Eastern Daylight Time) From: "Belinda Thompson" <belindat@us.ibm.com> To: <freebsd-threads@freebsd.org> Subject: pthread_cond_signal hang possible Message-ID: <45142FAA.000003.01864@THOMPSONB>
next in thread | raw e-mail | index | archive | help
Kernel: 2.6.5-7.244=0D glibc 2.3.2=0D =0D I am looking at an intermittent problem that appears to be pthread_cond_signal not returning. =0D =0D The mutex in question is only shared between two threads, one a read and = one a write thread for each "connection". =0D The mutex is protecting a queue that is filled by the RxThread...and drained by the TxThread.=0D =0D It looks like thread7 is unable to get the mutex back after being awakene= d from the pthread_cond_wait because thread8 is still holding it. =0D And..thread8 never returns from pthread_cond_signal to release the mutex.= =0D =0D Could thread8 have been preempted by thread7 preventing it from returning from the system call to wake the thread?=0D =0D Any ideas would be appreciated.=0D =0D The flow is simple and as follows:=0D =0D Thread7:=0D pthread_mutex_lock(mutex);=0D pthread_cond_wait(condition);=0D pthread_mutex_unlock(mutex)=0D =0D Thread8:=0D pthread_mutex_lock(mutex);=0D pthread_cond_signal(condition);=0D pthread_mutex_unlock(mutex);=0D =0D =0D The gdb output is as follows:=0D =0D [Switching to thread 7 (process 19955)]=0D #0 0x41ee8124 in __lll_lock_wait () from /lib/tls/libpthread.so.0=0D #1 0x41ee56fe in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0=0D #2 0x41df89da in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libc.so= =2E6=0D #3 0x00405daa in TxThread ()=0D #4 0x41ee2a8c in start_thread () from /lib/tls/libpthread.so.0=0D #5 0x41dec714 in thread_start () from /lib/tls/libc.so.6=0D =0D [Switching to thread 8 (process 19954)]=0D #0 0x41ee5c54 in pthread_cond_signal@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0=0D #1 0x41df8992 in pthread_cond_signal@@GLIBC_2.3.2 () from /lib/tls/libc.= so 6=0D #2 0x00407514 in TransmitPacket ()=0D #3 0x0040f3b8 in QueueTx ()=0D #4 0x0040d51c in Transmit ()=0D #5 0x0041237c in msg_handler ()=0D #6 0x004083d6 in newmail()=0D #7 0x00402e8a in put_message ()=0D #8 0x00404138 in PutMail ()=0D #9 0x004084a0 in send_msg()=0D #10 0x004067c0 in RxThread ()=0D #11 0x41ee2a8c in start_thread () from /lib/tls/libpthread.so.0=0D #12 0x41dec714 in thread_start () from /lib/tls/libc.so.6
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45142FAA.000003.01864>