On Thu, 14 Apr 2005, Donald J. Welch wrote:
> I am trying to figure out Debian defect #291429...
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291429
> 
> I changed the code to include a os.waitpid( -1, os.WNOHANG ) after the
> os.spawnvp() call. I am not very experienced with the way POSIX handles

The problem is that it is completely assyncronous, you would need to do it
in the main loop or somesuch.  The signal will get delivered when xsane
exits, which is usually well after os.spawnvp() returned...

Here's what wait(2) has to say about it:

        POSIX.1-2001 specifies that if the disposition of SIGCHLD is set to
SIG_IGN or the SA_NOCLDWAIT flag is set for SIGCHLD (see sigaction(2)), then
children that terminate do not become zombies and a call to wait() or
waitpid() will block until all children have  terminated,  and then fail
with errno set to ECHILD (The original POSIX standard left the behaviour of
setting SIGCHLD to SIG_IGN unspecified.)

        Linux 2.6 (since 2.6.9) conforms to this specification. However,
Linux 2.4 (and earlier) does not: if a wait() or waitpid() call is made
while SIGCHLD is being ignored, the call behaves just as though SIGCHLD
were not being ingored, that is, the call blocks until the next child
terminates and then returns the process ID and status of that child.

So, as long as nothing is needing to wait() or waitpid(), it should be
possible to just set the SIGCHLD to SIG_IGN with sigaction().  The manpage
is not clear if this will fix zombies in 2.4, but it just might.  BTW, I
have duplicated the problem using kernel 2.6, I have not tested it with
kernel 2.4.

The *easiest* and most portable way to fix this is probably to have the main
GUI loop do a os.waitpid( -1, os.WNOHANG ) every time it is awaken...  *if*
this is easy to do with PyQT, which I have no idea whatsoever.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to