You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by César Leonardo Blum Silveira <ce...@gmail.com> on 2007/07/17 15:30:26 UTC

Restart order

Hello,

I have a module which needs some information to persist across
restarts. In order to achieve that, I have registered a cleanup
function which stores the information on a DBM, and when the module is
restarted, the post_config function checks for the presence of that
DBM and, in case it is present, it restores the data.

However, that doesn't seem to always work. Sometimes the information
does not persist. I took a look at the error_log and noticed that the
messages were in the following order:

- Parent creates child
- A restart occurs, child is told to "die"
- The new child process is created
- The old child exits

I belive that when the child exits the cleanup is executed. Thus, the
new child process (which is started before the old child exists) does
not see the DBM (because it doesn't exist yet).

Is that correct? If so, it means I cannot rely on the assumption that
the cleanup will be executed before the new child process is created,
right?

By the way, this is being tested on Windows. That's why I'm speaking
of only one child process.

Hre is the error_log:

[Mon Jul 16 16:10:49 2007] [notice] Parent: Created child process 4828
[Mon Jul 16 16:10:51 2007] [notice] Child 4828: Child process is running
[Mon Jul 16 16:10:51 2007] [notice] Child 4828: Acquired the start mutex.
[Mon Jul 16 16:10:51 2007] [notice] Child 4828: Starting 250 worker threads.
[Mon Jul 16 16:11:09 2007] [notice] Parent: Received restart signal --
Restarting the server.
[Mon Jul 16 16:11:09 2007] [notice] Child 4828: Exit event signaled.
Child process is ending.
[Mon Jul 16 16:11:10 2007] [notice] Child 4828: Released the start mutex
[Mon Jul 16 16:11:11 2007] [notice] Parent: Created child process 3988
[Mon Jul 16 16:11:13 2007] [notice] Child 3988: Child process is running
[Mon Jul 16 16:11:13 2007] [notice] Child 3988: Acquired the start mutex.
[Mon Jul 16 16:11:13 2007] [notice] Child 3988: Starting 250 worker threads.
[Mon Jul 16 16:11:13 2007] [notice] Child 4828: Waiting for 250 worker
threads to exit.
[Mon Jul 16 16:11:13 2007] [notice] Child 4828: All worker threads have exited.
[Mon Jul 16 16:11:13 2007] [notice] Child 4828: Child process is exiting

Thank you,

-- 
César L. B. Silveira
http://cesarbs.wordpress.com/