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 2020/11/20 16:31:21 UTC
svn commit: r1883667 - /httpd/httpd/trunk/modules/ssl/mod_ssl_ct.c
Author: ylavic
Date: Fri Nov 20 16:31:21 2020
New Revision: 1883667
URL: http://svn.apache.org/viewvc?rev=1883667&view=rev
Log:
mod_ssl_ct: join the threads before their parent pools are destroyed.
This can happen on stop/restart for the daeomon thread, or on clean_child_exit()
for the service thread.
When an apr_thread_create()d thread exits it destroys its pool (in any case),
either explicitely when apr_thread_exit() is called, or implicitely after the
function returns (only in APR 2.0 for now).
So we should make sure that mod_ssl_ct's daemon and service threads exit before
pconf and pchild (the parent pools, respectively) destroy their children pools,
otherwise the threads' pool will be destroyed twice and cause a crash.
Using a pre_cleanup to wait for the threads avoids this.
Modified:
httpd/httpd/trunk/modules/ssl/mod_ssl_ct.c
Modified: httpd/httpd/trunk/modules/ssl/mod_ssl_ct.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/ssl/mod_ssl_ct.c?rev=1883667&r1=1883666&r2=1883667&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/mod_ssl_ct.c (original)
+++ httpd/httpd/trunk/modules/ssl/mod_ssl_ct.c Fri Nov 20 16:31:21 2020
@@ -864,6 +864,7 @@ static void * APR_THREAD_FUNC run_servic
ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, s, APLOGNO(03243)
SERVICE_THREAD_NAME " exiting");
+ apr_thread_exit(me, APR_SUCCESS);
return NULL;
}
@@ -1112,6 +1113,7 @@ static void *sct_daemon_thread(apr_threa
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(03246)
DAEMON_THREAD_NAME " - exiting");
+ apr_thread_exit(me, APR_SUCCESS);
return NULL;
}
@@ -1130,8 +1132,7 @@ static int daemon_thread_start(apr_pool_
return HTTP_INTERNAL_SERVER_ERROR;
}
- apr_pool_cleanup_register(pconf, daemon_thread, wait_for_thread,
- apr_pool_cleanup_null);
+ apr_pool_pre_cleanup_register(pconf, daemon_thread, wait_for_thread);
return OK;
}
@@ -2532,8 +2533,7 @@ static void ssl_ct_child_init(apr_pool_t
exit(APEXIT_CHILDSICK);
}
- apr_pool_cleanup_register(p, service_thread, wait_for_thread,
- apr_pool_cleanup_null);
+ apr_pool_pre_cleanup_register(p, service_thread, wait_for_thread);
if (sconf->proxy_awareness != PROXY_OBLIVIOUS) {
rv = apr_thread_mutex_create(&cached_server_data_mutex,