You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Alexey Toptygin <al...@freeshell.org> on 2005/12/13 01:21:18 UTC
2.0 hook questions
OK, I've been proceeding by code inspection, and I noticed this hack in
mod_auth_digest.c:
/* initialize_module() will be called twice, and if it's a DSO
* then all static data from the first call will be lost. Only
* set up our static data on the second call. */
apr_pool_userdata_get(&data, userdata_key, s->process->pool);
if (!data) {
apr_pool_userdata_set((const void *)1, userdata_key,
apr_pool_cleanup_null, s->process->pool);
return OK;
}
I tested, and the post_config hook does indeed get called twice. Why?
Also, I understand that the child_init hook is called once per child
process forked, not once per thread, correct?
Alexey
Re: 2.0 hook questions
Posted by Alexey Toptygin <al...@freeshell.org>.
On Mon, 12 Dec 2005, William A. Rowe, Jr. wrote:
> But be certain it's truly static, process lifetime scope data that you
> are storing there. Most of the time, it's wrong to persist through the
> graceful restarts and so forth. In my aspdotnet implementation, though,
> it's not possible to tear down the MS .NET engine, so it's easier to leave
> one instance running for the lifetime of the process.
Well, what I'm planning on using the post_config hook for is creating a
shared memory segment with apr_shm that the workers will use as an auth
credentials cache. Since the auth configuration could change across
a gracefull restart, that would invalidate the cache... so i guess I
should be shm_destroy()ing the segment if it already exists and creting a
new one, like mod_auth_digest does? Or maybe I need mod_ssl's somewhat
more complex approach... which doesn't seem to be guarding against
running twice on startup? Does mod_ssl really do init twice, or am I
missing something obvious?
Alexey
--
the more I learn about apache, the more confused I get. At least I
can read the code, unlike NSAPI :-P
Re: 2.0 hook questions
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Alexey Toptygin wrote:
> On Mon, 12 Dec 2005, William A. Rowe, Jr. wrote:
>
>> Alexey Toptygin wrote:
>>
>>>
>>> I tested, and the post_config hook does indeed get called twice. Why?
>>
>>
>> Apache processes the configuration, and verifies that it's correct
>> while still
>> connected to the console. It then flushes the config, detaches, and
>> reprocesses
>> the configuration.
>>
>> It's been this way since 0.6 or 0.8 according to Roy who's sitting
>> here :)
>
>
> Sorry, I'm new to apache development :-) Is the hack that
> mod_auth_digest uses OK to reuse in my code?
I've had to use the same hack in mod_aspdotnet.
But be certain it's truly static, process lifetime scope data that you
are storing there. Most of the time, it's wrong to persist through the
graceful restarts and so forth. In my aspdotnet implementation, though,
it's not possible to tear down the MS .NET engine, so it's easier to leave
one instance running for the lifetime of the process.
Re: 2.0 hook questions
Posted by Alexey Toptygin <al...@freeshell.org>.
On Mon, 12 Dec 2005, William A. Rowe, Jr. wrote:
> Alexey Toptygin wrote:
>>
>> I tested, and the post_config hook does indeed get called twice. Why?
>
> Apache processes the configuration, and verifies that it's correct while
> still
> connected to the console. It then flushes the config, detaches, and
> reprocesses
> the configuration.
>
> It's been this way since 0.6 or 0.8 according to Roy who's sitting here :)
Sorry, I'm new to apache development :-) Is the hack that mod_auth_digest
uses OK to reuse in my code?
Alexey
Re: 2.0 hook questions
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Alexey Toptygin wrote:
>
> I tested, and the post_config hook does indeed get called twice. Why?
Apache processes the configuration, and verifies that it's correct while still
connected to the console. It then flushes the config, detaches, and reprocesses
the configuration.
It's been this way since 0.6 or 0.8 according to Roy who's sitting here :)
Bill