--- /dev/null
+ * 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]
+
* add PROXY_WORKER_UDS_PATH_SIZE.
* 20211221.3 (2.5.1-dev) Add ap_thread_create(), ap_thread_main_create()
* and ap_thread_current()
+ * 20211221.4 (2.5.1-dev) Add hook child_stopped to get informed that a child
+ * has stopped processing any requests.
*
*/
#ifndef MODULE_MAGIC_NUMBER_MAJOR
#define MODULE_MAGIC_NUMBER_MAJOR 20211221
#endif
-#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */
+#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */
/**
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
(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
*/
}
if (pchild) {
+ ap_run_child_stopped(pchild, terminate_mode == ST_GRACEFUL);
apr_pool_destroy(pchild);
}
}
if (pchild) {
+ ap_run_child_stopped(pchild, 0);
apr_pool_destroy(pchild);
/*
* Be safe in case someone still uses afterwards or we get here again.
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(ctxpool_lock);
CloseHandle(ctxpool_wait_event);
}
if (pchild) {
+ ap_run_child_stopped(pchild, terminate_mode == ST_GRACEFUL);
apr_pool_destroy(pchild);
}
APR_HOOK_LINK(input_pending) \
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(
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)