You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Massimo Manghi <mx...@apache.org> on 2015/10/01 00:23:48 UTC

Tcl [exit] command analysis

I'm almost back on line as usual now.

I checked last week the code of the prefork and worker MPMs: it seems to 
me there is no API exposed to the module programming level meant to 
terminate a process.

The prefork and worker MPMs (I have little doubt it's the same for the 
event MPM) both have a clean_child_exit function declared as static, 
therefore private to the file's scope. These functions do some module 
specific tasks (usually calling other private functions) and then call 
exit().

The fact the MPMs do certain chores before calling exit implies it is 
not a good thing to call exit() ourselves, its equivalent to some fatal 
fault occurring to the child process from the web server point of view. 
It's something we can do but we should stress this point: it's not the 
right way and should be avoided

The problem becomes more severe with the worker MPM. Rivet's worker MPM 
bridge runs its own pool of threads each running at least one Tcl 
interpreter. This pool is controlled by a supervisor thread and it's 
easy to let our [exit] implementation notify each thread in the pool to 
orderly exit before the supervisor terminates the process by calling 
exit().

Nonetheless without a way to tell the child process to stop accepting 
connections we almost certainly are leaving some requests unprocessed 
unless we manage this 'shutting down' status and return 500 error codes 
for those requests.

  -- Massimo




---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org