httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olov Andersson" <>
Subject Process Initialization State - The finer points?
Date Sun, 30 Nov 2008 13:04:49 GMT

I am converting an Apache 1.3 one-thread-per-process module to an Apache2
worker multi-thread multi-process environment. I need to retain some
internal connections between outside client connections. To do this in the
most efficient manner seems to be using an apr_reslist per *process* with
pooled connections. So far so good, but I need to initialize this pool, and
I'm a bit uncertain of the module initilization state.

Assuming it is running on UNIX, is the following correct?
1) You need to allocate the reslist with connections in a child_init hook.
2) Put it in the process pool to have it properly shut down at process exit.

Which takes me to the tricky part:
3) Is the child_init hook only run *one time per process* by *one* thread
ever? I guess best way to fix this otherwise would be with a mutex on an
init state variable?
4) Are children forked from a *dormant* parent process that is *never* used
to serve requests and has *not* run child_init? Therefore children will have
no connections/file descriptors or any state dependent on
child_init inherited at all? Otherwise if processes are forked with an
existing connection reslist, the only thing I can think of for knowing when
to (re-)initialize the connection reslist is to keep track of with which
process ID it was initialized.

Any guidance greately appreciated.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message