[Pidgin] #1496: Signal handling crashes some non-Linux platforms
Pidgin
trac at pidgin.im
Fri Jun 1 16:47:28 EDT 2007
#1496: Signal handling crashes some non-Linux platforms
--------------------------+-------------------------------------------------
Reporter: psfales | Type: defect
Status: new | Priority: minor
Component: pidgin (gtk) | Version: 2.0.1
Keywords: | Pending: 0
--------------------------+-------------------------------------------------
I'm workin on porting pidgin to several non Linux platforms. On several
of them, the handling of SIGCHLD results in unlimited stack growth until
the stack limit is reached and the program crashes.
pigdin/gtkmain.c has code in sighandler() which looks like this:
case SIGCHLD:
/* Restore signal catching */
signal(SIGCHLD, sighandler);
alarm(1);
break;
case SIGALRM:
clean_pid();
break;
The comments indicate that we want to wait one second before calling
waitpid() to reap the child processes. However, on some platforms
(Solaris 2.5.1, HP/UX 10.20 and Irix 6.2) as soon as signal() is called,
sighandler() is immediately called again to inform the process that not
all of the children have been wait'ed on yet. This results in
sighandler() being continuosly called and continuosly growing its stack.
As a workaround, I tried moving the "signal(SIGCHLD, sighandler);" down
inside the clean_pid() function after all the waitpid() calls have been
completed (i.e the same place SIGALRM is re-enabled). It appears to work,
but I don't know the code well enough to say that all scenarios are
covered.
I've only actually verified this in 2.0.0, but the code looks the same in
2.0.1
--
Ticket URL: <http://developer.pidgin.im/ticket/1496>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list