summaryrefslogtreecommitdiffstats
path: root/server/mpm (follow)
Commit message (Collapse)AuthorAgeFilesLines
* mpm_worker: Fix AH00045 about children processes not terminating timely.Yann Ylavic2024-04-121-18/+32
| | | | | | | | | | | | | | | | | | | * server/mpm/worker/worker.c(setup_threads_runtime): Create pollset with APR_POLLSET_WAKEABLE to be able to wake up the listener when stopping. * server/mpm/worker/worker.c(wakeup_listener): Wake up the listener using the wakeup pipe (apr_pollset_wakeup). * server/mpm/worker/worker.c(join_workers): Like mpm_event, don't depend on `pthread_kill(listener_thread, 0)` to check whether the listener has exited (this does not work on some systems), but use the "dying" global variable instead which is set by the listener just before exiting. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916926 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Simplify pollset "good methods" vs APR_POLLSET_WAKEABLE.Yann Ylavic2024-04-121-13/+11
| | | | | | | | | | | | | | | | | * server/mpm/event/event.c(setup_threads_runtime): Simplify pollset creation code. All pollset "good methods" implement APR_POLLSET_WAKEABLE and wake-ability is quite important for MPM event's correctness anyway so simplify code around pollset creation so as not to suggest that APR_POLLSET_NODEFAULT if favored against APR_POLLSET_WAKEABLE. While at it account for the wakeup pipe in the pollset_size since not all pollset methods seem to do it internally in APR. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916925 13f79535-47bb-0310-9956-ffa450edef68
* shutdown carefully when threads don't startEric Covener2024-03-132-3/+38
| | | | | | | Submitted By: ylavic, covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916267 13f79535-47bb-0310-9956-ffa450edef68
* use graceful exit if lister startedEric Covener2024-03-121-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916243 13f79535-47bb-0310-9956-ffa450edef68
* event: avoid possible hang in clean_child_exitEric Covener2024-03-111-0/+1
| | | | | | | | | | | | | If the pthread_create failure isn't on the first worker thread, another one is likely to hold the queue mutex already. The cleanup of pchild will try to cleanup the queue and block on destroying the condition. ST_UNGRACEFUL as we have no listener thread yet. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1916241 13f79535-47bb-0310-9956-ffa450edef68
* Make sources build with latest clang versionStefan Eissing2023-04-271-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1909450 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: useful APLOG_DEBUG messages.Yann Ylavic2023-04-011-8/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1908883 13f79535-47bb-0310-9956-ffa450edef68
* mpm_winnt: Follow up to r1902636: another compilation error.Yann Ylavic2022-07-111-1/+1
| | | | | | | | Same error, elsewhere. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1902641 13f79535-47bb-0310-9956-ffa450edef68
* mpm_winnt: Fix compilation error.Yann Ylavic2022-07-101-1/+1
| | | | | | | | server\mpm\winnt\child.c(1210,1): error C2440: 'initializing': cannot convert from 'worker_info' to 'worker_info *' git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1902636 13f79535-47bb-0310-9956-ffa450edef68
* mpm_prefork: Do not access the POD in ONE_PROCESS mode.Yann Ylavic2022-06-161-8/+6
| | | | | | | | | | | | There is no POD created in ONE_PROCESS mode, so avoid crashing in child_main() and clean_child_exit(). While at it, remove a dead code path in prefork_run() which is never reached since the one_process path already returns/exits above. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901974 13f79535-47bb-0310-9956-ffa450edef68
* *) de-duplicate ALOGNO from code copy.Stefan Eissing2022-04-191-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1900024 13f79535-47bb-0310-9956-ffa450edef68
* * Port r1899858, r1899865 to worker MPMRuediger Pluem2022-04-151-3/+23
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899884 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Follow up to r1899858: Avoid explicit sleep.Yann Ylavic2022-04-141-12/+11
| | | | | | | | | | Instead, we can simply go to ap_wait_or_timeout() again. While at it, improve the comment about killed processes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899865 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Handle children killed pathologically.Yann Ylavic2022-04-141-3/+24
| | | | | | | | | | | | | If children processes get killed (SIGSEGV/SIGABRT/..) early after starting or frequently enough then we never enter perform_idle_server_maintenance() to try something. Below three successive children killed restart them immediately, above three let's sleep the usual 1s (to avoid fork()s flood) and do the idle maintenance. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899858 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Follow up to r1899777: Fix max_daemon_used.Yann Ylavic2022-04-131-9/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899812 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Fix accounting of active/total processes on ungraceful restart.Yann Ylavic2022-04-121-52/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Children processes terminated by ap_{reclaim,relieve}_child_processes() were were not un-accounted for total_daemons and active_daemons, which was done in server_main_loop() only. This led to perform_idle_server_maintenance() thinking it was over the limit of children processes and never create new ones. Have this accounting right in event_note_child_{started,stopped}() which is called both at runtime and reload time. * server/mpm/event/event.c(struct event_retained_data): Rename field max_daemons_limit to max_daemon_used to better describe what it's about and to align with AP_MPMQ_MAX_DAEMON_USED. * server/mpm/event/event.c(event_note_child_stopped): Renamed from event_note_child_killed() to clarify that it's not only called when a child is killed (i.e. on restart) but whenever a child has stopped. * server/mpm/event/event.c(event_note_child_stopped): Move decrementing {active,total}_daemons and marking child's threads as SERVER_DEAD from server_main_loop() so that it's done both at runtime and reload time. Log the current number/state of daemons at APLOG_DEBUG level for each child stopped. * server/mpm/event/event.c(event_note_child_started): Move incrementing {active,total}_daemons from make_child() for symmetry, given that make_child() calls event_note_child_started(). Log the current number/state of daemons at APLOG_DEBUG level for each child started. * server/mpm/event/event.c(perform_idle_server_maintenance): Fix possible miscounting of retained->max_daemon_used accross the multiple calls to perform_idle_server_maintenance() if ListenCoresBucketsRatio > 0. Pass an int *max_daemon_used which starts at zero and is bumped consistently for all the buckets, while retained->max_daemon_used is updated only after all the buckets have been maintained. * server/mpm/event/event.c(perform_idle_server_maintenance): Use event_note_child_stopped() to handle exited children processes. Fixes: BZ 66004 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899777 13f79535-47bb-0310-9956-ffa450edef68
* *) mod_watchdog: add assertions to cleanup codeStefan Eissing2022-02-251-6/+13
| | | | | | | | | | *) core/mpm_preform: do not invoke the fancy new child_stopping/stopped hooks when invoked from a signal handler. This is a stopgap to some strange behaviour in need of some deeper insight. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898418 13f79535-47bb-0310-9956-ffa450edef68
* *) core/prefork: run new hook `child_stopped` only on clean exit.Stefan Eissing2022-02-241-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898381 13f79535-47bb-0310-9956-ffa450edef68
* * core/mpm: add hook 'child_stopped` that gets called when the MPM hasStefan Eissing2022-02-244-0/+5
| | | | | | | | | | 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
* *) mpm/winnt: add running the 'child_stopping' hook.Stefan Eissing2022-02-221-0/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898317 13f79535-47bb-0310-9956-ffa450edef68
* *) core/mod_ssl/mpm_event: reverting changes to nonblocing SSL handshakesStefan Eissing2022-02-041-91/+15
| | | | | | | | | | to stabilize CI tests again. Previous revision of trunk has been copied to branches/trunk-ssl-handshake-unblocking to make those into a PR where changes can be discussed and tested separately. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897760 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Use APR_POLLEXCL when available to prevent thundering hurd.Yann Ylavic2022-01-271-0/+9
| | | | | | | | | | | | If APR_POLLEXCL is available, use it to prevent the thundering herd issue. The listening sockets are potentially polled by all the children at the same time, when new connections arrive this avoids all of them to be woken up while most would get EAGAIN on accept(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897551 13f79535-47bb-0310-9956-ffa450edef68
* core: Follow up to r1897460: Provide ap_thread_main_create().Yann Ylavic2022-01-273-72/+10
| | | | | | | | | | | | | Replace ap_thread_current_create() by ap_thread_main_create() which is how it's used by httpd. The former is now a local helper only to implement the latter. This allows to consolidate/factorize common code in the main() of httpd and the unix MPMs. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897543 13f79535-47bb-0310-9956-ffa450edef68
* core: Follow up to r1897460: Implement and use ap_thread_current_after_fork().Yann Ylavic2022-01-254-31/+12
| | | | | | | | | | | | | | | | | | | | | | | | | thread_local variables are not (always?) reset on fork(), so we need a way to set the current_thread to NULL in the child process. Implement and use ap_thread_current_after_fork() for that. * include/httpd.h: Define ap_thread_current_after_fork(). * server/util.c: Implement ap_thread_current_after_fork(). * server/mpm/event/event.c, server/mpm/prefork/prefork.c, server/mpm/worker/worker.c: Use ap_thread_current_after_fork(). * server/mpm/winnt/child.c: Windows processes are not fork()ed and each child runs the main(), so ap_thread_current_create() was already called there. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897472 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1897460: APLOGNOs.Yann Ylavic2022-01-254-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897461 13f79535-47bb-0310-9956-ffa450edef68
* core: Efficient ap_thread_current() when apr_thread_local() is missing.Yann Ylavic2022-01-254-59/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | #define ap_thread_create, ap_thread_current_create and ap_thread_current to their apr-1.8+ equivalent if available, or implement them using the compiler's thread_local mechanism if available, or finally provide stubs otherwise. #define AP_HAS_THREAD_LOCAL to 1 in the two former case or 0 otherwise, while AP_THREAD_LOCAL is defined to the compiler's keyword iff AP_HAS_THREAD_LOCAL. Replace all apr_thread_create() calls with ap_thread_create() so that httpd threads can use ap_thread_current()'s pool data as Thread Local Storage. Bump MMN minor. * include/httpd.h(): Define AP_HAS_THREAD_LOCAL, AP_THREAD_LOCAL (eventually), ap_thread_create(), ap_thread_current_create() and ap_thread_current(). * server/util.c: Implement ap_thread_create(), ap_thread_current_create() and ap_thread_current() when APR < 1.8. * modules/core/mod_watchdog.c, modules/http2/h2_workers.c, modules/ssl/mod_ssl_ct.c: Use ap_thread_create() instead of apr_thread_create. * server/main.c: Use AP_HAS_THREAD_LOCAL and ap_thread_current_create instead of APR's. * server/util_pcre.c: Use AP_HAS_THREAD_LOCAL and ap_thread_current instead of APR's. * server/mpm/event/event.c, server/mpm/worker/worker.c, server/mpm/prefork/prefork.c: Use ap_thread_create() instead of apr_thread_create. Create an apr_thread_t/ap_thread_current() for the main chaild thread usable at child_init(). * server/mpm/winnt/child.c: Use ap_thread_create() instead of CreateThread(). Create an apr_thread_t/ap_thread_current() for the main chaild thread usable git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897460 13f79535-47bb-0310-9956-ffa450edef68
* Begone, foul tabs.Graham Leggett2022-01-241-5/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897424 13f79535-47bb-0310-9956-ffa450edef68
* event: Add AP_MPM_CAN_AGAIN and AGAIN to signal to the MPM thatGraham Leggett2022-01-241-3/+8
| | | | | | | non blocking behaviour is requested. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897423 13f79535-47bb-0310-9956-ffa450edef68
* Add missing log message tag.Graham Leggett2022-01-231-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897388 13f79535-47bb-0310-9956-ffa450edef68
* event: Allow the MPM to explicitly handle CONN_SENSE_WANT_WRITE insteadGraham Leggett2022-01-231-8/+13
| | | | | | | | of support being implicit. Pass the desired sense depending on the state, no longer default to write. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897385 13f79535-47bb-0310-9956-ffa450edef68
* Shutdown immediately on read timeout.Graham Leggett2022-01-221-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897351 13f79535-47bb-0310-9956-ffa450edef68
* event: Add support for non blocking behaviour in theGraham Leggett2022-01-211-8/+74
| | | | | | | | | CONN_STATE_READ_REQUEST_LINE phase, in addition to the existing CONN_STATE_WRITE_COMPLETION phase. Update mod_ssl to perform non blocking TLS handshakes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897281 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Fix a possible listener deadlock. PR 65769.Yann Ylavic2021-12-291-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the listener starts accepting more connections than the number of workers already started (due to scheduling), the listening sockets gets disabled (per AH03269) but nothing was re-enabling them before the end of the connections, despite the creation of more idle/available workers in the meantime. In the wost case there is no idle worker when the listener accepts the first connection thus nothing to wake up the listener blocked in poll() with no socket, hence a deadlock. Fix this by waking up the listener when a worker becomes idle and this unblocks connections_above_limit(). This is also worthwhile when all the workers are started (fully initialized runtime) since the number of idle workers is a condition for connections_above_limit() anyway so the sooner the listeners are re-enabled the better (the other condition is the number of connections which is unblocked appropriately by decrement_connection_count() already). Also when a child exists with ps->quiescing == 1 and it's caught by server_main_loop() before perform_idle_server_maintenance(), active_daemons was not decrement as needed (including accross restarts), leading to an invalid active_daemons accounting. * server/mpm/event/event.c(should_enable_listensocks): New helper that returns whether listenning sockets can be poll()ed again. * server/mpm/event/event.c(decrement_connection_count, listener_thread): Use should_enable_listensocks() where previously open-coded. * server/mpm/event/event.c(worker_thread): Wake up the listener when is_idle => 1 and should_enable_listensocks(). Have a single point of exit when workers_may_exit to make sure that the wake always occurs (even when exiting). * server/mpm/event/event.c(server_main_loop): Decrement active_daemons not only when !ps->quiescing but also when ps->quiescing == 1, i.e. all the cases not handled by perform_idle_server_maintenance() already. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1896505 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Follow up to r1895553.Yann Ylavic2021-12-061-4/+10
| | | | | | | | | We can still kill processes above MaxSpareThreads at every maintenance cycle unless there is not enough headromm in the scoreboard for a graceful restart. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895630 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1895551: seems to break python tests..Yann Ylavic2021-12-031-1/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895562 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Follow up to r1894285: new MaxSpareThreads heuristics.Yann Ylavic2021-12-031-21/+15
| | | | | | | | | | | | When at MaxSpareThreads, instead of deferring the stop if we are close to active/server limit let's wait for the pending exits to complete. This way we always and accurately account for slow-to-exit processes to avoid filling up the scoreboard, whether at the limits or not. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895553 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Close the listeners first for ungraceful stop too.Yann Ylavic2021-12-031-0/+1
| | | | | | | | Just like for graceful stop. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895551 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Retain active_daemons instead of resetting it on restart.Yann Ylavic2021-12-031-14/+13
| | | | | | | | | | | | | | Since active_daemons is tracked by perform_idle_server_maintenance() and decremented when a child gets quiescing or exits, clearing it on restart is actually an off by -total_daemons (of the old gen) after the first calls to perform_idle_server_maintenance(). Let perform_idle_server_maintenance() be the only one to update active_daemons by putting it in the retained struct to keep track accross restarts. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895550 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event,worker}: Really perform_idle_server_maintenance() per bucket.Yann Ylavic2021-10-154-50/+54
| | | | | | | | | | | | | | | | | | mpm_{event,worker}: No need to pass num_buckets to perform_idle_server_maintenance() and server_main_loop(). mpm_worker: the last used scoreboard slot depends on pid != 0 only. Align max_daemons_limit value on all MPMs. That's the number of scoreboard slots in use, so it shouldn't be negative. Fix off by one in OS/2 too. Submitted by: ylavic <ylavic.dev@gmail.com> Github: closes #274 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894291 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1894285: add idle_threads and max_workers to trace5.Yann Ylavic2021-10-151-2/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894286 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Restart stopping of idle children after a load peak. PR 65626.Yann Ylavic2021-10-151-3/+9
| | | | | | | | | | | | | | | r1770752 added an heuristic to avoid stopping children when the load triggers MaxSpareThreads but children take some time to shut down until the point where active_daemons_limit/ServerLimit is reached (scoreboard full) and no child gets created to handle incoming connections. However when this happens there is nothing to stop children again when the load settles down (besides MaxRequestsPerChild, which may be 0) so let's restart to stop children again if/when idle_thread_count reaches max_workers / 4. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894285 13f79535-47bb-0310-9956-ffa450edef68
* * Correctly decrement active_daemons also in the case that the childRuediger Pluem2021-09-221-1/+4
| | | | | | | | | process decides on its own to die because of MaxRequestsPerChild. PR: 65592 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893520 13f79535-47bb-0310-9956-ffa450edef68
* * Follow up to r1893497: Make use of ap_pre_connection in mpm_motorz and ↵Ruediger Pluem2021-09-212-4/+2
| | | | | | mpm_simple_io git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893498 13f79535-47bb-0310-9956-ffa450edef68
* In case one of the pre_connection hooks causes the hook run to stop by an errorRuediger Pluem2021-09-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | the pre_connection hook of the core module maybe did not run (it is APR_HOOK_REALLY_LAST) and hence we missed to - Put the socket in c->conn_config - Setup core output and input filters - Set socket options and timeouts For calls of ap_run_pre_connection where this matters create a wrapper named ap_pre_connection that ensures that this happens. * include/ap_mmn.h: Bump minor version as we added new ap_pre_connection function. * include/http_connection.h: Declare ap_pre_connection prototype. * server/connection.c: Make use of ap_pre_connection in ap_process_connection. * server/core.c: Implement ap_pre_connection. * server/mpm/event/event.c: Make use of ap_pre_connection. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893497 13f79535-47bb-0310-9956-ffa450edef68
* MPMs: cap idle_spawn_rate to MAX_SPAWN_RATE.Yann Ylavic2021-09-204-11/+39
| | | | | | | | | | | | idle_spawn_rate *= 2 can go above MAX_SPAWN_RATE at some point, and it's not enough for MAX_SPAWN_RATE to be a power of two for MPMs event and worker since idle_spawn_rate is per bucket (num_buckets is not necessarily a power of two). Let's cap on the other MPMs too should MAX_SPAWN_RATE change in the future. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893471 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Follow up to r1893014: log when children are not spawned.Yann Ylavic2021-09-071-1/+12
| | | | | | | | | Log at trace5 level when active_daemons >= active_daemons_limit and we won't spawn children. Reset free_length to avoid negative value in this case too. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893073 13f79535-47bb-0310-9956-ffa450edef68
* mpm_event: Fix children processes possibly not stopped on graceful restart.Yann Ylavic2021-09-071-0/+3
| | | | | | | | | | | The number of children spawned can go above active_daemons_limit due to exponential idle_spawn_rate growth (x 2), enforce the upper limit in perform_idle_server_maintenance(). PR 63169. Proposed by: Joel Self <joelself gmail.com> git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1893014 13f79535-47bb-0310-9956-ffa450edef68
* mpm_{event,worker,prefork}: follow up to r1892587: restore ungraceful on MPM ↵Yann Ylavic2021-08-254-3/+20
| | | | | | | | | change. While at it add a comment for the rationale, including for MPM motorz. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892595 13f79535-47bb-0310-9956-ffa450edef68
* mpm_{event,worker,prefork}: late stop of children processes on restart.Yann Ylavic2021-08-253-376/+400
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change how the main process handles restarts, from: 0. <restart signal> 1. stop old generation of children processes (graceful or not) 2. reload new configuration 3. start new generation of children processes to: 0. <restart signal> 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1892587 13f79535-47bb-0310-9956-ffa450edef68
* * core/mpm: add hook 'child_stopping` that gets called when the MPM isStefan Eissing2021-07-313-2/+17
| | | | | | | | | stopping a child process. The additional `graceful` parameter allows registered hooks to free resources early during a graceful shutdown. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891919 13f79535-47bb-0310-9956-ffa450edef68