From Bugzilla Helper: User-Agent: Mozilla/4.76 [fr] (X11; U; Linux 2.2.16-3 i686) This simple program locks itself after less than a minute if linked with libpthread #include <stdio.h> #include <signal.h> void sig(int s) { fprintf(stderr,"Au revoir\n"); } main() { int pid=fork(); signal(SIGUSR1,sig); if (pid) { for (;;) fprintf(stderr,"Bonjour\n"); } else { for (;;) kill(getppid(),SIGUSR1); } } When locked, here is gdb frameset (gdb) bt #0 0x4004cdcb in __sigsuspend (set=0xbfffa9e8) at ../sysdeps/unix/sysv/linux/sigsuspend.c:48 #1 0x40022c62 in __pthread_wait_for_restart_signal (self=0x4002a920) at pthread.c:783 #2 0x400242a2 in __pthread_lock (lock=0x4011ca08, self=0x4002a920) at spinlock.c:68 #3 0x4002182a in __pthread_mutex_lock (mutex=0x4011c9f8) at mutex.c:92 #4 0x40023c2b in __flockfile (stream=0x4011ca20) at lockfile.c:32 #5 0x40078760 in buffered_vfprintf (s=0x4011ca20, format=0x80485e0 "Au revoir\n", args=0xbfffd264) at vfprintf.c:1762 #6 0x40073966 in _IO_vfprintf (s=0x4011ca20, format=0x80485e0 "Au revoir\n", ap=0xbfffd264) at vfprintf.c:1029 #7 0x4007c027 in fprintf (stream=0x4011ca20, format=0x80485e0 "Au revoir\n") at fprintf.c:32 #8 0x8048523 in sig (s=10) at test.c:6 #9 0x4004cc48 in __restore () at ../sysdeps/unix/sysv/linux/i386/sigaction.c:127 #10 0x4002182a in __pthread_mutex_lock (mutex=0x4011c9f8) at mutex.c:92 #11 0x40023c2b in __flockfile (stream=0x4011ca20) at lockfile.c:32 #12 0x40078760 in buffered_vfprintf (s=0x4011ca20, format=0x80485eb "Bonjour\n", args=0xbffffb34) at vfprintf.c:1762 #13 0x40073966 in _IO_vfprintf (s=0x4011ca20, format=0x80485eb "Bonjour\n", ap=0xbffffb34) at vfprintf.c:1029 #14 0x4007c027 in fprintf (stream=0x4011ca20, format=0x80485eb "Bonjour\n") at fprintf.c:32 #15 0x8048560 in main () at test.c:15 Same problem after updating to glibc-devel-2.1.3-22 glibc-2.1.3-22 Reproducible: Always Steps to Reproduce: 1.Look at description 2. 3. Actual Results: Program locked in sigsuspend() Expected Results: Program running forever without locking itself
printf in signal handlers isnt defined. You probably want to be waking a thread that does the signal handling printf work.