Skip to content
Commit bb54252a authored by Ralf S. Engelschall's avatar Ralf S. Engelschall
Browse files

Enhance Shared Object Loading (II)

----------------------------------

mod_so now keeps track itself of which modules are actually loaded and which
are not by remembering both the module pointer and the module name. This fixes
two problems:

1. Because our server configuration is read twice the modules
   were loaded twice which is both not needed and leads to confusion later on
   unload because the OS-internal load counter increases. Then on unload the
   module pointer was removed from the Apache core structure on the first
   unloads but (because of the load counter) the modules were removed later.
   Although this worked, it was very ugly. The only consequence is that we now
   keep track of loaded modules ourself and don't rely on the dynamic loader
   of the platform. This now also avoids multiply tries to unload an already
   unloaded module and thus removes harmless but irritating error_log entries
   ``[error] Cannot remove module mod_setenvif.c: not found in module list''.
   as shown below.

2. Because we now keep track of the module names we used on loading we now can
   give correct corresponding log messages even on unloading.

To illustrate the change, here is the old error_log:
(the first unloads correspond to the first loads which
 are printed on stderr unless mod_log_config is present)

[debug] mod_so.c(163): unloaded module mod_setenvif.c
[debug] mod_so.c(163): unloaded module mod_access.c
[debug] mod_so.c(163): unloaded module mod_userdir.c
[debug] mod_so.c(163): unloaded module mod_dir.c
[debug] mod_so.c(163): unloaded module mod_autoindex.c
[debug] mod_so.c(163): unloaded module mod_negotiation.c
[debug] mod_so.c(163): unloaded module mod_log_config.c
[error] Cannot remove module mod_setenvif.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_setenvif.c
[error] Cannot remove module mod_access.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_access.c
[error] Cannot remove module mod_userdir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_userdir.c
[error] Cannot remove module mod_dir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_dir.c
[error] Cannot remove module mod_autoindex.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_autoindex.c
[error] Cannot remove module mod_negotiation.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_negotiation.c
[error] Cannot remove module mod_log_config.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_log_config.c
[error] Cannot remove module mod_setenvif.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_setenvif.c
[error] Cannot remove module mod_access.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_access.c
[error] Cannot remove module mod_userdir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_userdir.c
[error] Cannot remove module mod_dir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_dir.c
[error] Cannot remove module mod_autoindex.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_autoindex.c
[error] Cannot remove module mod_negotiation.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_negotiation.c
[error] Cannot remove module mod_log_config.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_log_config.c
[debug] mod_so.c(211): loaded module config_log_module
[debug] mod_so.c(211): loaded module negotiation_module
[debug] mod_so.c(211): loaded module autoindex_module
[debug] mod_so.c(211): loaded module dir_module
[debug] mod_so.c(211): loaded module userdir_module
[debug] mod_so.c(211): loaded module access_module
[debug] mod_so.c(211): loaded module setenvif_module
[debug] mod_so.c(211): loaded module config_log_module
[debug] mod_so.c(211): loaded module negotiation_module
[debug] mod_so.c(211): loaded module autoindex_module
[debug] mod_so.c(211): loaded module dir_module
[debug] mod_so.c(211): loaded module userdir_module
[debug] mod_so.c(211): loaded module access_module
[debug] mod_so.c(211): loaded module setenvif_module
[debug] mod_so.c(211): loaded module config_log_module
[debug] mod_so.c(211): loaded module negotiation_module
[debug] mod_so.c(211): loaded module autoindex_module
[debug] mod_so.c(211): loaded module dir_module
[debug] mod_so.c(211): loaded module userdir_module
[debug] mod_so.c(211): loaded module access_module
[debug] mod_so.c(211): loaded module setenvif_module
[notice] Apache/1.3b6-dev configured -- resuming normal operations
[notice] httpd: caught SIGTERM, shutting down
[debug] mod_so.c(163): unloaded module mod_setenvif.c
[debug] mod_so.c(163): unloaded module mod_access.c
[debug] mod_so.c(163): unloaded module mod_userdir.c
[debug] mod_so.c(163): unloaded module mod_dir.c
[debug] mod_so.c(163): unloaded module mod_autoindex.c
[debug] mod_so.c(163): unloaded module mod_negotiation.c
[debug] mod_so.c(163): unloaded module mod_log_config.c
[error] Cannot remove module mod_setenvif.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_setenvif.c
[error] Cannot remove module mod_access.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_access.c
[error] Cannot remove module mod_userdir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_userdir.c
[error] Cannot remove module mod_dir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_dir.c
[error] Cannot remove module mod_autoindex.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_autoindex.c
[error] Cannot remove module mod_negotiation.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_negotiation.c
[error] Cannot remove module mod_log_config.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_log_config.c
[error] Cannot remove module mod_setenvif.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_setenvif.c
[error] Cannot remove module mod_access.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_access.c
[error] Cannot remove module mod_userdir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_userdir.c
[error] Cannot remove module mod_dir.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_dir.c
[error] Cannot remove module mod_autoindex.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_autoindex.c
[error] Cannot remove module mod_negotiation.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_negotiation.c
[error] Cannot remove module mod_log_config.c: not found in module list
[debug] mod_so.c(163): unloaded module mod_log_config.c

And this is the one with the new mod_so.c:
(again the first unloads correspond to the first loads which
 are printed on stderr unless mod_log_config is present)

[debug] mod_so.c(191): unloaded module setenvif_module
[debug] mod_so.c(191): unloaded module access_module
[debug] mod_so.c(191): unloaded module userdir_module
[debug] mod_so.c(191): unloaded module dir_module
[debug] mod_so.c(191): unloaded module autoindex_module
[debug] mod_so.c(191): unloaded module negotiation_module
[debug] mod_so.c(191): unloaded module config_log_module
[debug] mod_so.c(261): loaded module config_log_module
[debug] mod_so.c(261): loaded module negotiation_module
[debug] mod_so.c(261): loaded module autoindex_module
[debug] mod_so.c(261): loaded module dir_module
[debug] mod_so.c(261): loaded module userdir_module
[debug] mod_so.c(261): loaded module access_module
[debug] mod_so.c(261): loaded module setenvif_module
[notice] Apache/1.3b6-dev configured -- resuming normal operations
[notice] httpd: caught SIGTERM, shutting down
[debug] mod_so.c(191): unloaded module setenvif_module
[debug] mod_so.c(191): unloaded module access_module
[debug] mod_so.c(191): unloaded module userdir_module
[debug] mod_so.c(191): unloaded module dir_module
[debug] mod_so.c(191): unloaded module autoindex_module
[debug] mod_so.c(191): unloaded module negotiation_module
[debug] mod_so.c(191): unloaded module config_log_module


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@80461 13f79535-47bb-0310-9956-ffa450edef68
parent 06c7a1f7
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment