On 8/25/21 12:22 AM, yla...@apache.org wrote:
> Author: ylavic
> Date: Tue Aug 24 22:22:40 2021
> New Revision: 1892587
>
> URL: http://svn.apache.org/viewvc?rev=1892587&view=rev
> Log:
> mpm_{event,worker,prefork}: late stop of children processes on restart.
>
> Change how the main process handles restarts, from:
> 0.
> 1. stop old generation of children processes (graceful or not)
> 2. reload new configuration
> 3. start new generation of children processes
> to:
> 0.
> 1. reload new configuration
> 2. stop old generation of children processes (graceful or not)
> 3. start new generation of children processes
>
> The delay between stop and start is now very short and does not depend on the
> reload time (which can be quite long with many vhosts and/or complex setups
> with regexps or whatever third party components to compile).
>
> Also, while reloading, the old generation of children processes keeps
> accepting
> and handling incoming connections until the new generation is up to take over.
>
> * os/unix/unixd.c (sig_term, sig_restart):
> Set AP_MPMQ_STOPPING only once.
>
> * server/listen.c (ap_duplicate_listeners):
> Use ap_log_error() the main server instead of ap_log_perror().
>
> * server/mpm/{event,worker,prefork}/{event,worker,prefork}.c
> ({event,worker,prefork}_retained_data):
> Save the generation pool pointer (gen_pool) and all the buckets here, they
> won't be cleared before the reload like pconf so they need a persitent
> storage accross restarts (i.e. retained->gen_pool).
>
> * server/mpm/{event,worker,prefork}/{event,worker,prefork}.c
> (perform_idle_server_maintenance, child_main, make_child):
> Change usage of all_buckets (previously with global/static scope) to the new
> retained->buckets array.
>
>
> Modified:
> httpd/httpd/trunk/os/unix/unixd.c
> httpd/httpd/trunk/server/listen.c
> httpd/httpd/trunk/server/mpm/event/event.c
> httpd/httpd/trunk/server/mpm/prefork/prefork.c
> httpd/httpd/trunk/server/mpm/worker/worker.c
>
> Modified: httpd/httpd/trunk/server/mpm/event/event.c
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1892587&r1=1892586&r2=1892587&view=diff
> ==
> --- httpd/httpd/trunk/server/mpm/event/event.c (original)
> +++ httpd/httpd/trunk/server/mpm/event/event.c Tue Aug 24 22:22:40 2021
> @@ -3753,16 +3761,13 @@ static int event_pre_config(apr_pool_t *
> if (!retained) {
> retained = ap_retained_data_create(userdata_key, sizeof(*retained));
> retained->mpm = ap_unixd_mpm_get_retained_data();
> +retained->mpm->baton = retained;
> retained->max_daemons_limit = -1;
> if (retained->mpm->module_loads) {
> test_atomics = 1;
> }
> }
> retained->mpm->mpm_state = AP_MPMQ_STARTING;
> -if (retained->mpm->baton != retained) {
> -retained->mpm->was_graceful = 0;
Why is this no longer needed?
> -retained->mpm->baton = retained;
> -}
> ++retained->mpm->module_loads;
>
> /* test once for correct operation of fdqueue */
>
> Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1892587&r1=1892586&r2=1892587&view=diff
> ==
> --- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
> +++ httpd/httpd/trunk/server/mpm/worker/worker.c Tue Aug 24 22:22:40 2021
> @@ -2024,13 +2033,10 @@ static int worker_pre_config(apr_pool_t
> if (!retained) {
> retained = ap_retained_data_create(userdata_key, sizeof(*retained));
> retained->mpm = ap_unixd_mpm_get_retained_data();
> +retained->mpm->baton = retained;
> retained->max_daemons_limit = -1;
> }
> retained->mpm->mpm_state = AP_MPMQ_STARTING;
> -if (retained->mpm->baton != retained) {
> -retained->mpm->was_graceful = 0;
Why is this no longer needed?
> -retained->mpm->baton = retained;
> -}
> ++retained->mpm->module_loads;
>
> /* sigh, want this only the second time around */
>
>
>
Regards
RĂ¼diger