]> git.ipfire.org Git - thirdparty/apache/httpd.git/commit
mpm_event: Fix accounting of active/total processes on ungraceful restart.
authorYann Ylavic <ylavic@apache.org>
Tue, 24 May 2022 09:00:19 +0000 (09:00 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 24 May 2022 09:00:19 +0000 (09:00 +0000)
commit138691a51ced29d2717b98784080bc50e9a0610a
tree1c0d369d5f7ae716fdda6022c76d82eb4b9f55dd
parent08f0d557be6a91c83c30f2b0b5771c2a55e60b76
mpm_event: Fix accounting of active/total processes on ungraceful restart.

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.

Follow up to r1899777: CHANGES entry.

mpm_event: Follow up to r1899777: Fix max_daemon_used.

Merge r1899777, r1899786, r1899812 from trunk.
Fixes: BZ 66004
Submitted by: ylavic
Reviewed by: ylavic, rpluem, jorton

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1901199 13f79535-47bb-0310-9956-ffa450edef68
CHANGES
server/mpm/event/event.c