ASF Bugzilla – Attachment 35372 Details for
Bug 61558
Apache 2.4.27 crashes often when restarting the service. segfault in libdl-2.24.so or apache2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Make ap_mpm_query() restart safe on unixes (for 2.4.x)
unixd_mpm_query.patch (text/plain), 4.30 KB, created by
Yann Ylavic
on 2017-09-25 11:08:53 UTC
(
hide
)
Description:
Make ap_mpm_query() restart safe on unixes (for 2.4.x)
Filename:
MIME Type:
Creator:
Yann Ylavic
Created:
2017-09-25 11:08:53 UTC
Size:
4.30 KB
patch
obsolete
>Index: os/unix/unixd.c >=================================================================== >--- os/unix/unixd.c (revision 1809298) >+++ os/unix/unixd.c (working copy) >@@ -582,7 +582,42 @@ AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool > apr_pool_cleanup_null); > } > >+static int ap_unixd_mpm_query(int query_code, int *result, apr_status_t *rv) >+{ >+ if (retained_data && retained_data->mpm_query_fn) { >+ return retained_data->mpm_query_fn(query_code, result, rv); >+ } >+ else { >+ return DECLINED; >+ } >+} > >+static apr_status_t ap_unixd_mpm_query_cleanup(void *fn) >+{ >+ if (retained_data && retained_data->mpm_query_fn == fn) { >+ retained_data->mpm_query_fn = NULL; >+ } >+ return APR_SUCCESS; >+} >+ >+/* To cope with restarts (when the mpm_query function may have been unloaded >+ * with the DSO), we register the hook once and keep/clear the current function >+ * in retained_data->mpm_query_fn, according to the given pool's lifetime. >+ */ >+AP_DECLARE(void) ap_unixd_hook_mpm_query(apr_pool_t *p, >+ int (*fn)(int, int*, apr_status_t*)) >+{ >+ static int once = 0; >+ if (!once) { >+ once = 1; >+ ap_hook_mpm_query(ap_unixd_mpm_query, NULL, NULL, APR_HOOK_MIDDLE); >+ } >+ >+ ap_unixd_mpm_get_retained_data()->mpm_query_fn = fn; >+ apr_pool_cleanup_register(p, fn, ap_unixd_mpm_query_cleanup, >+ apr_pool_cleanup_null); >+} >+ > #ifdef _OSD_POSIX > > #include "apr_lib.h" >Index: os/unix/unixd.h >=================================================================== >--- os/unix/unixd.h (revision 1809298) >+++ os/unix/unixd.h (working copy) >@@ -129,11 +129,17 @@ typedef struct { > * eg. idle_spawn_rate). > */ > int num_buckets, max_buckets; >+ >+ /* Hooked mpm_query function. */ >+ int (*mpm_query_fn)(int, int*, apr_status_t*); > } ap_unixd_mpm_retained_data; > > AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data(void); > AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool_t *pconf, int once_process); > >+AP_DECLARE(void) ap_unixd_hook_mpm_query(apr_pool_t *p, >+ int (*fn)(int, int *, apr_status_t*)); >+ > #ifdef __cplusplus > } > #endif >Index: server/mpm/event/event.c >=================================================================== >--- server/mpm/event/event.c (revision 1809299) >+++ server/mpm/event/event.c (working copy) >@@ -3597,7 +3597,7 @@ static void event_hooks(apr_pool_t * p) > ap_hook_post_config(event_post_config, NULL, NULL, APR_HOOK_MIDDLE); > ap_hook_check_config(event_check_config, NULL, NULL, APR_HOOK_MIDDLE); > ap_hook_mpm(event_run, NULL, NULL, APR_HOOK_MIDDLE); >- ap_hook_mpm_query(event_query, NULL, NULL, APR_HOOK_MIDDLE); >+ ap_unixd_hook_mpm_query(p, event_query); > ap_hook_mpm_register_timed_callback(event_register_timed_callback, NULL, NULL, > APR_HOOK_MIDDLE); > ap_hook_pre_read_request(event_pre_read_request, NULL, NULL, APR_HOOK_MIDDLE); >Index: server/mpm/prefork/prefork.c >=================================================================== >--- server/mpm/prefork/prefork.c (revision 1809298) >+++ server/mpm/prefork/prefork.c (working copy) >@@ -1423,7 +1423,7 @@ static void prefork_hooks(apr_pool_t *p) > ap_hook_pre_config(prefork_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); > ap_hook_check_config(prefork_check_config, NULL, NULL, APR_HOOK_MIDDLE); > ap_hook_mpm(prefork_run, NULL, NULL, APR_HOOK_MIDDLE); >- ap_hook_mpm_query(prefork_query, NULL, NULL, APR_HOOK_MIDDLE); >+ ap_unixd_hook_mpm_query(p, prefork_query); > ap_hook_mpm_get_name(prefork_get_name, NULL, NULL, APR_HOOK_MIDDLE); > } > >Index: server/mpm/worker/worker.c >=================================================================== >--- server/mpm/worker/worker.c (revision 1809298) >+++ server/mpm/worker/worker.c (working copy) >@@ -2257,7 +2257,7 @@ static void worker_hooks(apr_pool_t *p) > ap_hook_pre_config(worker_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); > ap_hook_check_config(worker_check_config, NULL, NULL, APR_HOOK_MIDDLE); > ap_hook_mpm(worker_run, NULL, NULL, APR_HOOK_MIDDLE); >- ap_hook_mpm_query(worker_query, NULL, NULL, APR_HOOK_MIDDLE); >+ ap_unixd_hook_mpm_query(p, worker_query); > ap_hook_mpm_get_name(worker_get_name, NULL, NULL, APR_HOOK_MIDDLE); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 61558
:
35362
|
35363
|
35364
|
35365
|
35366
|
35367
|
35368
|
35369
|
35372
|
35375
|
35376
|
35377
|
35378
|
35379
|
35380
|
35381