[Zope-Coders] Signal forwarding

Chris McDonough chrism@zope.com
Tue, 08 Oct 2002 05:58:01 -0400


What should probably happen is: if we are running under zdaemon, write 
the zdaemon pid to the Z2.pid file.  If not, write the Zope pid to the 
Z2.pid logfile.  Don't write a zProcessManager.pid file at all.  zdaemon 
should accept an (optional) argument which is the pidfile name it should 
write to (as zdaemon is used under ZEO as well).

This might break some scripts that rely on being able to "cut" the 
contents of the Z2.pid file, but most things will continue to work 
(particularly the idiom of "kill `cat Z2.pid`".

Does this sound reasonable?

Toby Dickenson wrote:
> On Monday 07 Oct 2002 1:21 pm, Chris McDonough wrote:
> 
>>Yikes.  Yes, that looks right...
>>
>>On Mon, 2002-10-07 at 08:52, Toby Dickenson wrote:
>>
>>>What happens when Zope or ZEO is run under a supervisor process, and the
>>>supervisor process receives a signal such as SIGINT? The intention is
>>>that it should forward the signal on to the server process.
>>>
>>>This mechanism is currently very broken, due to the typo fixed in the
>>>patch below.
>>>
>>>This is definitely a problem that needs fixing - currently the signals
>>>get forwarded get forwarded to the wrong processes, which could be
>>>disasterous if the supervisor process is running as root.
>>>
>>>Can anyone see a problem with this fix?
>>
> 
> Since looking into this pid issue I have discovered some other wierdness.
> 
> z2.py writes a Z2.pid file containing two pids - its own pid and its parents 
> pid.  If you are using a supervisor process then this parent pid is the 
> supervisor, otherwise it is likely to be the start script etc.
> 
> So why do we have the idiom that *both* of these processes need to be 
> signalled. Z2.pid is used in the default stop script, or the default log 
> rotation script in CHANGES.txt? Im sure it is not healthy for the stop script 
> to be sending SIGINT to the pid of the long-dead start script.
> 
> 
> In all of these cases I think the external scripts should be signalling:
> 1. the zope process if you are not using a supervisor process
> 2. the supervisor process, if you have one. it will do the right thing in 
>    forwarding signals on to the zope process.
> 
> Right now we dont have a pid file that always contains the one right pid 
> according to those rules, and Im not sure how we resolve this without 
> breaking somebody's current usage of the existing pid files....
> 
> any thoughts?
> 
> 

-- 
Chris McDonough                    Zope Corporation
http://www.zope.org             http://www.zope.com
"Killing hundreds of birds with thousands of stones"