You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2017/09/27 16:28:09 UTC
svn commit: r1809881 - /httpd/httpd/trunk/server/main.c
Author: ylavic
Date: Wed Sep 27 16:28:09 2017
New Revision: 1809881
URL: http://svn.apache.org/viewvc?rev=1809881&view=rev
Log:
core: deregister all hooks before leaving pconf, otherwise some late cleanup
or function call (e.g. ap_log) may use one while DSOs are unloaded.
See PR 61558 (double/second fault).
Modified:
httpd/httpd/trunk/server/main.c
Modified: httpd/httpd/trunk/server/main.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/main.c?rev=1809881&r1=1809880&r2=1809881&view=diff
==============================================================================
--- httpd/httpd/trunk/server/main.c (original)
+++ httpd/httpd/trunk/server/main.c Wed Sep 27 16:28:09 2017
@@ -295,6 +295,13 @@ static int abort_on_oom(int retcode)
return retcode; /* unreachable, hopefully. */
}
+static apr_status_t deregister_all_hooks(void *unused)
+{
+ (void)unused;
+ apr_hook_deregister_all();
+ return APR_SUCCESS;
+}
+
static process_rec *init_process(int *argc, const char * const * *argv)
{
process_rec *process;
@@ -497,6 +504,10 @@ int main(int argc, const char * const ar
}
#endif
+ /* Deregister all hooks (lastly) when done with pconf */
+ apr_pool_cleanup_register(pconf, NULL, deregister_all_hooks,
+ apr_pool_cleanup_null);
+
apr_pool_create(&pcommands, ap_pglobal);
apr_pool_tag(pcommands, "pcommands");
ap_server_pre_read_config = apr_array_make(pcommands, 1,
@@ -743,10 +754,13 @@ int main(int argc, const char * const ar
do {
ap_main_state = AP_SQ_MS_DESTROY_CONFIG;
- apr_hook_deregister_all();
apr_pool_clear(pconf);
ap_clear_auth_internal();
+ /* Deregister all hooks (lastly) when done with pconf */
+ apr_pool_cleanup_register(pconf, NULL, deregister_all_hooks,
+ apr_pool_cleanup_null);
+
ap_main_state = AP_SQ_MS_CREATE_CONFIG;
ap_config_generation++;
for (mod = ap_prelinked_modules; *mod != NULL; mod++) {