Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP4
apache2.34444
apache2-core-mpm-add-hook-child_stopped-that-ge...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File apache2-core-mpm-add-hook-child_stopped-that-gets-called-whe.patch of Package apache2.34444
Backport from upstream - does not increase MAGIC NUMBER in include/ap_mmn.h. From 2e239ed8e65a0a7cc5f12d64b4d21cc92ab08709 Mon Sep 17 00:00:00 2001 From: Stefan Eissing <icing@apache.org> Date: Thu, 24 Feb 2022 11:53:53 +0000 Subject: [PATCH] * core/mpm: add hook 'child_stopped` that gets called when the MPM has stopped all processing in a child process. This is when all running threads shall be stopped and joined. [Stefan Eissing] git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898369 13f79535-47bb-0310-9956-ffa450edef68 --- changes-entries/mpm_child_stopped.txt | 5 +++++ include/ap_mmn.h | 4 +++- include/mpm_common.h | 20 ++++++++++++++++++-- server/mpm/event/event.c | 1 + server/mpm/prefork/prefork.c | 1 + server/mpm/winnt/child.c | 2 ++ server/mpm/worker/worker.c | 1 + server/mpm_common.c | 6 +++++- 8 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 changes-entries/mpm_child_stopped.txt Index: httpd-2.4.51/changes-entries/mpm_child_stopped.txt =================================================================== --- /dev/null +++ httpd-2.4.51/changes-entries/mpm_child_stopped.txt @@ -0,0 +1,5 @@ + * core/mpm: add hook 'child_stopped` that gets called when the MPM has + stopped all processing in a child process. This is when all running + threads shall be stopped and joined. + [Stefan Eissing] + Index: httpd-2.4.51/include/mpm_common.h =================================================================== --- httpd-2.4.51.orig/include/mpm_common.h +++ httpd-2.4.51/include/mpm_common.h @@ -453,14 +453,30 @@ AP_DECLARE_HOOK(void, resume_connection, (conn_rec *c, request_rec *r)) /** - * Notification that the child is stopping. If graceful, ongoing - * requests will be served. + * Notification that the child is stopping. No new requests + * or other tasks to be started. + * If graceful, already started requests/tasks should be + * processed normally. * @param pchild The child pool * @param graceful != 0 iff this is a graceful shutdown. */ AP_DECLARE_HOOK(void, child_stopping, (apr_pool_t *pchild, int graceful)) +/** + * Notification that the child has stopped processing + * requests completely. Any running threads should be + * shut down now. + * Ideally, when this hook completes, no more threads + * are running in the child process. + * Note that de-allocation of global resources should + * be run via memory pool destroy callback after this. + * @param pchild The child pool + * @param graceful != 0 iff this is a graceful shutdown. + */ +AP_DECLARE_HOOK(void, child_stopped, + (apr_pool_t *pchild, int graceful)) + /* mutex type string for accept mutex, if any; MPMs should use the * same mutex type for ease of configuration */ Index: httpd-2.4.51/server/mpm/event/event.c =================================================================== --- httpd-2.4.51.orig/server/mpm/event/event.c +++ httpd-2.4.51/server/mpm/event/event.c @@ -727,6 +727,7 @@ static void clean_child_exit(int code) } if (pchild) { + ap_run_child_stopped(pchild, terminate_mode == ST_GRACEFUL); apr_pool_destroy(pchild); } Index: httpd-2.4.51/server/mpm/prefork/prefork.c =================================================================== --- httpd-2.4.51.orig/server/mpm/prefork/prefork.c +++ httpd-2.4.51/server/mpm/prefork/prefork.c @@ -228,6 +228,7 @@ static void clean_child_exit(int code) } if (pchild) { + ap_run_child_stopped(pchild, 0); apr_pool_destroy(pchild); } Index: httpd-2.4.51/server/mpm/winnt/child.c =================================================================== --- httpd-2.4.51.orig/server/mpm/winnt/child.c +++ httpd-2.4.51/server/mpm/winnt/child.c @@ -1281,6 +1281,8 @@ void child_main(apr_pool_t *pconf, DWORD ap_log_error(APLOG_MARK, APLOG_NOTICE, APR_SUCCESS, ap_server_conf, APLOGNO(00364) "Child: All worker threads have exited."); + ap_run_child_stopped(pchild, graceful_shutdown); + apr_thread_mutex_destroy(child_lock); apr_thread_mutex_destroy(qlock); CloseHandle(qwait_event); Index: httpd-2.4.51/server/mpm/worker/worker.c =================================================================== --- httpd-2.4.51.orig/server/mpm/worker/worker.c +++ httpd-2.4.51/server/mpm/worker/worker.c @@ -439,6 +439,7 @@ static void clean_child_exit(int code) } if (pchild) { + ap_run_child_stopped(pchild, terminate_mode == ST_GRACEFUL); apr_pool_destroy(pchild); } Index: httpd-2.4.51/server/mpm_common.c =================================================================== --- httpd-2.4.51.orig/server/mpm_common.c +++ httpd-2.4.51/server/mpm_common.c @@ -73,7 +73,8 @@ APR_HOOK_LINK(child_status) \ APR_HOOK_LINK(suspend_connection) \ APR_HOOK_LINK(resume_connection) \ - APR_HOOK_LINK(child_stopping) + APR_HOOK_LINK(child_stopping) \ + APR_HOOK_LINK(child_stopped) #if AP_ENABLE_EXCEPTION_HOOK APR_HOOK_STRUCT( @@ -116,6 +117,9 @@ AP_IMPLEMENT_HOOK_VOID(resume_connection AP_IMPLEMENT_HOOK_VOID(child_stopping, (apr_pool_t *pchild, int graceful), (pchild, graceful)) +AP_IMPLEMENT_HOOK_VOID(child_stopped, + (apr_pool_t *pchild, int graceful), + (pchild, graceful)) /* hooks with no args are implemented last, after disabling APR hook probes */ #if defined(APR_HOOK_PROBES_ENABLED)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor