diff options
author | Yann Ylavic <ylavic@apache.org> | 2020-11-20 17:31:21 +0100 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2020-11-20 17:31:21 +0100 |
commit | adb6b3ce7d67c9738ac6f403647d5914a76329d3 (patch) | |
tree | 8c653ef883db599d3b1c17bed4ccb17c41a1ab20 /modules/ssl/mod_ssl_ct.c | |
parent | Follow up to r1883639: debug log for rfc7231#section-5.1.1 (diff) | |
download | apache2-adb6b3ce7d67c9738ac6f403647d5914a76329d3.tar.xz apache2-adb6b3ce7d67c9738ac6f403647d5914a76329d3.zip |
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.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1883667 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | modules/ssl/mod_ssl_ct.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/ssl/mod_ssl_ct.c b/modules/ssl/mod_ssl_ct.c index c2de848d38..535ea4449e 100644 --- a/modules/ssl/mod_ssl_ct.c +++ b/modules/ssl/mod_ssl_ct.c @@ -864,6 +864,7 @@ static void * APR_THREAD_FUNC run_service_thread(apr_thread_t *me, void *data) 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_thread_t *me, void *data) 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_t *pconf, server_rec *s_main) 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 *p, server_rec *s) 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, |