Subj : Re: pthread_create hangs To : comp.programming.threads From : gg Date : Thu Apr 14 2005 10:38 am gg wrote: > gg wrote: > >> Hi, >> >> I'm developping a multi-thread application on debian sarge, kernel >> 2.4.28. When I do heavy-load tests, pthread_create sometimes hangs and >> __pthread_manager thread takes all CPU (R status) : >> top : >> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND >> 6909 vocal 16 0 17404 16m 15m R 18.4 3.4 0:53.32 cvfmon >> >> __pthread_manager thread : >> (gdb) bt >> #0 0x4054385a in poll () from /lib/libc.so.6 >> #1 0x40429b50 in __pthread_manager () from /lib/libpthread.so.0 >> #2 0x4054c69a in clone () from /lib/libc.so.6 >> >> pthread_create thread : >> >> #0 0x4042c604 in __pthread_sigsuspend () from /lib/libpthread.so.0 >> #1 0x4042c3c8 in __pthread_wait_for_restart_signal () from >> /lib/libpthread.so.0 >> #2 0x4042bc42 in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0 >> #3 0x0805abb2 in cvfmon_pthread_create (id=0x80959f0, bool_joinable=1, >> init=0xfffffffc, arg=0xfffffffc, fct_appelante=0x808746c "babySitter") >> at commun.c:1653 >> #4 0x08061540 in babySitter () at canal.c:2490 >> #5 0x40429e51 in pthread_start_thread () from /lib/libpthread.so.0 >> #6 0x4054c69a in clone () from /lib/libc.so.6 >> >> I haven't been able to make simpler test programs that reproduce this >> problem. >> Any idea? >> >> Thanx in advance. >> >> Regards, > > Hi, > > > I had a look at __pthread_manager code, it seems to be a loop, that calls > the poll function on a pipe (__pthread_manager_reader file descripteur) in > order to wait for pthread_create request. > > A problem with the pipe could be the origin of my "pthread_create hangs" > and "R status for __pthread_manager" problems. > > If the pipe is out of order, the poll function call fails, the request > can't be read from the pipe, and the pthread_manager thread loops without > sleeping. > > What can be the problem with the pipe? > What do you think about this hypothesis? > > Thanks in advance, > Regards, Hi, I tried to print errno with gdb at after a poll function call : the value is 4 == EINTR : interrupted system call. Any idea? Thanks in advance, Regards, .