On Fri, 12 Nov 2010, Jeff Trawick wrote:
On Fri, Nov 12, 2010 at 2:59 PM, William A. Rowe Jr.
<wr...@rowe-clan.net> wrote:
On 11/12/2010 12:47 PM, Stefan Fritsch wrote:
it is common procedure for modules to detect the first configuration
run at httpd startup by looking for some userdata in the process pool.
If the userdata is not set, they set it and then skip some
initialization that should not be done during the first config run.

But this logic is broken: If a LoadModule statement is added while
httpd is running, and httpd is then gracefully restarted, the module
will be loaded but assume that this is the startup configuration
phase. It won't initialize itself fully and will work correctly only
after the second graceful restart. This can be very confusing for
users.

That's why you would generally add a pool datum to the process->pool,
which survives module unload/reload.


see also ap_retained_data_{create|get} which hides the pool trick; but
Stefan is getting at a specific question that the module wants to ask
so that it can potentially work if added across restart

which questions should modules be able to ask?

last-load/init-before-activation?          (seems to work for most purposes)

Yes, that's what I meant: Will the current config be actually used to process requests?

pre-detach-load/init?     (never seen when added during restart)
(not to mention weird Windows stuff -- is this the parent or the
child, and which pass)

Is this something that modules need to be aware of? Usually it's just that the module needs to do something time-consuming, but only wants to do it for the config that is actually used for requests. E.g mod_rewrite will skip spawning the rewrite map children during the first config run, and mod_php will skip initializing its interpreter. If there are modules that need more specific information, the new API should probably provide that. But I am not aware of any such modules.

should pre-config and post-config just get an indicator?

I am not sure what you mean here.

Cheers,
Stefan

Reply via email to