On Fri, Nov 12, 2010 at 4:10 PM, Stefan Fritsch <[email protected]> wrote: > On Fri, 12 Nov 2010, Jeff Trawick wrote: >> >> On Fri, Nov 12, 2010 at 2:59 PM, William A. Rowe Jr. >> <[email protected]> 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.
anything that prompts the user for passphrase or wants to issue a warning message cares about pre-detach I'm not sure about awareness of the Windows oddity; my vague understanding is that a lot of modules perform wasted init in the Windows parent. If was important to know, how would the module check? > >> should pre-config and post-config just get an indicator? > > I am not sure what you mean here. sorry; "other parameter(s) to those hooks to tell them the server state" (but modifying the parameter lists is an aggravating migration step)
