httpd issues the message
"server reached MaxClients setting, consider raising the
MaxClients setting"
as soon as the number of spare threads drops below MinSpareThreads. In
a pathological case where MinSpareThreads is high, the number of threads
actually in use might be nowhere near MaxClients.
Here's a possible solution. It checks whether we're really at
MaxClients,
or just below MinSpareThreads, and issues a more accurate message. The
new
message will only be issued once. If we do hit MaxClients for real, the
original message will still be issued.
The patch is against trunk.
Dan
Index: server/mpm/worker/worker.c
===================================================================
--- server/mpm/worker/worker.c (revision 756126)
+++ server/mpm/worker/worker.c (working copy)
@@ -1509,15 +1509,27 @@
/* terminate the free list */
if (free_length == 0) { /* scoreboard is full, can't fork */
- if (active_thread_count >= ap_daemons_limit *
ap_threads_per_child) {
- static int reported = 0;
- if (!reported) {
- /* only report this condition once */
- ap_log_error(APLOG_MARK, APLOG_ERR, 0,
- ap_server_conf,
- "server reached MaxClients setting,
consider"
- " raising the MaxClients setting");
- reported = 1;
+ if (active_thread_count >= ap_daemons_limit *
ap_threads_per_child) {
+ /* no threads are "inactive" - starting, stopping, etc.
*/
+ /* Are all threads in use? */
+ if (0 == idle_thread_count) {
+ static int reported = 0;
+ if (!reported) {
+ /* only report this condition once */
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0,
+ ap_server_conf,
+ "server reached MaxClients
setting, consider"
+ " raising the MaxClients
setting");
+ reported = 1;
+ }
+ } else {
+ static int reported = 0;
+ if (!reported) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0,
+ ap_server_conf,
+ "server is within MinSpareThreads
of MaxClients, "
+ "consider raising the MaxClients
setting");
+ }
}
}
else {