Stas Bekman wrote:
I think this misleading error is really a bug in Apache:
I agree.
[Mon Apr 26 15:28:44 2004] [error] server reached MaxClients setting, consider raising the MaxClients setting
It seems to happen when the parent is trying to increase the number of child processes but they haven't initialized yet and the server is temporarily out of worker threads. I didn't see the number of active workers reach MaxClients. Re-examining the test that leads to the message:
else if (idle_thread_count < min_spare_threads) { <== cool /* terminate the free list */ if (free_length == 0) { <== insufficient
I wasn't able to confirm the theory that this line is wrong. I stuck in an assert() to force the parent to coredump right before issuing the message. Much to my surprise I saw ap_daemons_limit (basically MaxClients/ThreadsPerChild, after sanity checking and rounding) active child processes. I couldn't verify the state of the worker threads at the instant the assert() hit from the dump since the children continued to run and update the scoreboard while the parent was dumping it.
Perhaps the parent should anticipate how many worker threads will eventually become active after it forks/kills children, and to take this into account before doing anything rash like forking or writing error messages. But that will take some thought and this code is gnarly.
I'm a little rusty on this code,
I was able to confirm this theory :(
Thanks, Greg. Am I right to say that you now have an itch to scratch and get it solved? :)
I have an itch but no good solution so far. Ideas/patches are welcome, especially ones that simplify this code.
Greg
