[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1057126: Bug#1067104: Acknowledgement (server stalls: AH00046: child process 2876749 still did not exit, sending a SIGKILL)



I think "my" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067104
is a duplicate of this one.  I blame mod_wsgi since this I believe
started to happen after I started to use it.

FWIW here is a dirty workaround script I just crafted with chatgpt to
monitor/restart apache2 as soon as it starts happening (doesn't happen upon
every maintenance event for me I believe). Let me know if I should gather any
additional information.

	#!/bin/bash

	set -eu

	# Define the lock file and log directory
	lock_file="/var/log/apache-scoreboard-restart/lock.lck"
	log_dir="/var/log/apache-scoreboard-restart/"

	# Ensure the log directory exists
	mkdir -p "$log_dir"

	# Attempt to acquire a lock
	exec 200>"$lock_file"
	if ! flock -n 200 ; then
		echo "Another instance is running."
		exit 0
	fi

	# Function to perform actions when the specified log line is found
	handle_scoreboard_full() {
		local timestamp=$(date --iso-8601=seconds)
		local log_file="${log_dir}${timestamp}.log"

		echo "Logging system information to $log_file."
		{ ps auxw -H; echo "---"; lsof; } > "$log_file"

		echo "Reloading Apache." >> "$log_file"
		service apache2 reload

		echo "Sleeping for a minute." >> "$log_file"
		sleep 60
	}

	# Monitor the Apache error log
	while true; do
		tail --follow=name /var/log/apache2/error.log | while read line ; do
			if echo "$line" | grep -q "AH03490: scoreboard is full, not at MaxRequestWorkers.Increase ServerLimit." ; then
			handle_scoreboard_full
			break  # so we start with a fresh tail
			fi
		done
	done

-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
WWW:   http://www.linkedin.com/in/yarik        

Attachment: signature.asc
Description: PGP signature


Reply to: