deadloop in zdrun.py leaves parent process hung

Bug #143735 reported by Darryl Dixon
2
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Medium
Unassigned

Bug Description

Under certain conditions, the runforever() function in zdrun.py will deadloop attempting to kill.SIGKILL a defunct child process (which will never suceed). It can be triggered by starting and stopping a zope instance from code running in another zope instance (both instances running as the same unprivileged user account) with the 'zopectl start' and 'zopectl stop' commands.
Sample workflow:
Have two zope instances.
Have code in one instance that executes a shell command to start, then executes another shell command to stop the other instance.
The stop command will fail - the child processes are left as 'defunct' and the parent will loop forever sending KILL commands to them (which will obviously not succeed).

Suggested fix: set the child pid to '0' with self.proc.setstatus(0) immediately after sending the SIGKILL (the only conditions under which SIGKILL will not remove the process from the process table is when it is a zombie, as per above). This correctly fixes the problem (tested OK).

Tags: bug zope
Revision history for this message
Darryl Dixon (esrever-otua) wrote :

PATCH:
--- app/zope-stable/lib/python/zdaemon/zdrun.py 2006-07-07 15:00:13.246377264 +1200
+++ /u01/app/zope-stable/lib/python/zdaemon/zdrun.py 2006-07-07 13:59:46.502932790 +1200
@@ -421,6 +421,7 @@
                     if self.killing and self.proc.pid:
                         self.proc.kill(signal.SIGKILL)
                         self.delay = time.time() + self.options.backofflimit
+ self.proc.setstatus(0)
             try:
                 r, w, x = select.select(r, w, x, timeout)
             except select.error, err:

Changed in zope2:
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.