[Zope-Coders] Signal forwarding

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 7 Oct 2002 13:52:48 +0100


What happens when Zope or ZEO is run under a supervisor process, and the=20
supervisor process receives a signal such as SIGINT? The intention is tha=
t it=20
should forward the signal on to the server process.

This mechanism is currently very broken, due to the typo fixed in the pat=
ch=20
below.

This is definitely a problem that needs fixing - currently the signals ge=
t=20
forwarded get forwarded to the wrong processes, which could be disasterou=
s if=20
the supervisor process is running as root.

Can anyone see a problem with this fix?


Index: Daemon.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs-repository/Zope/lib/python/zdaemon/Daemon.py,v
retrieving revision 1.11
diff -c -2 -r1.11 Daemon.py
*** Daemon.py   14 Aug 2002 22:12:52 -0000      1.11
--- Daemon.py   7 Oct 2002 12:43:46 -0000
***************
*** 43,47 ****
                  # ie. HUP, INT, QUIT, USR1, USR2, TERM
                  for sig in interesting:
!                     signal.signal(sig, SignalPasser(sig))
                  pstamp('Houston, we have forked: pid %s' % pid, zLOG.IN=
FO)
                  write_pidfile(pidfile)
--- 43,47 ----
                  # ie. HUP, INT, QUIT, USR1, USR2, TERM
                  for sig in interesting:
!                     signal.signal(sig, SignalPasser(pid))
                  pstamp('Houston, we have forked: pid %s' % pid, zLOG.IN=
FO)
                  write_pidfile(pidfile)