httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@covalent.net
Subject Re: cvs commit: httpd-2.0/server config.c
Date Sun, 21 Jan 2001 22:08:07 GMT

On Sun, 21 Jan 2001, Greg Stein wrote:

> On Sun, Jan 21, 2001 at 05:21:34AM -0000, rbb@apache.org wrote:
> > rbb         01/01/20 21:21:34
> > 
> >   Modified:    server   config.c
> >   Log:
> >   Add a call to apr_hook_deregister_all() in the clear_module_list function.
> >   The basic problem was that when we load the modules, we call the
> >   register_hooks() function from the module, but then we clear the module
> >   list for all active modules, and add them back in one at a time.  When we
> >   add them back, we re-call the register_hooks() function, thus adding
> >   each function a second time.  This was causing apache.org to log every
> >   request twice in the access log.  By calling apr_hook_deregister_all()
> >   when we unload the module, the second call to register the hooks is the
> >   only call that matters.
> 
> I think you've identified a more subtle problem. The registrations should
> have happened within the command pool, which should have been cleared as the
> modules were unloaded.
> 
> Needing to make the above change would indicate the pool wasn't cleared
> properly.
> 
> I'm not sure that deregister_all would ever be needed, and is probably not
> quite correct: other registrations happen during register_hooks(). Filters
> are registered, and live properties are registered with mod_dav.

I have reviewed this in much more detail, and the current code is
correct.  The modules are loaded out of the pconf pool, because that is
the pool used for information read out of the config file.  The problem is
that we read the first directive, the LoadModule, and we call
ap_add_module, which calls the register hooks function for the module.

Whe then encounter the ClearModuleList directive, which doesn't actually
unload any modules, it just moves them from the active to the inactive
list.

Then, as we wncounter the AddModule directive we re-call the
register_hooks function.

There is no pool to clear, and we don't want to either, because that would
actually unload the module, which isn't our goal.  Unfortunately, this
also means that all of the hooks have already been registered, and that
registration remains.  By adding this simple call to
ap_hooks_deregister_all, we solve that problem.

This problem should go away if we just remove the AddModule and
ClearModuleList directives however, because we stop having two module
lists.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Mime
View raw message