I think this misleading error is really a bug in Apache:

[Mon Apr 26 15:28:44 2004] [error] server reached MaxClients setting, consider raising the MaxClients setting

It sounds like a one-off bug to me. It reports that error when the number of workers is the same as MaxClients, which is perfectly fine. It should only report a problem when a new request is coming in and there are no free servers/threads to handle the request.

In any case, we get users confused and reporting this as an error when running the test suites. So the following is about to fix that on the client side. I introduce a new -minclients which replaces -maxclients, and now it really does what it should - it allows you to set the minimal amount of workers your test suite needs to complete. -maxclients by default is minclients+1 to avoid this misleading error, but available for explicit setting by a user/developer.

I needed to expand the prefork settings as well to include the (min/max)spare settings.

Here is the patch (both A-T and mp2):

Index: Apache-Test/lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.222
diff -u -r1.222 TestConfig.pm
--- Apache-Test/lib/Apache/TestConfig.pm 16 Apr 2004 20:29:23 -0000 1.222
+++ Apache-Test/lib/Apache/TestConfig.pm 26 Apr 2004 22:29:09 -0000
@@ -75,7 +75,8 @@
startup_timeout => 'seconds to wait for the server to start (default is 60)',
httpd_conf => 'inherit config from this file (default is apxs derived)',
httpd_conf_extra=> 'inherit additional config from this file',
- maxclients => 'maximum number of concurrent clients (default is 1)',
+ minclients => 'minimum number of concurrent clients (default is 1)',
+ maxclients => 'maximum number of concurrent clients (default is minclients+1)',
perlpod => 'location of perl pod documents (for testing downloads)',
proxyssl_url => 'url for testing ProxyPass / https (default is localhost)',
sslca => 'location of SSL CA (default is $t_conf/ssl/ca)',
@@ -279,7 +280,8 @@
$vars->{user} ||= $self->default_user;
$vars->{group} ||= $self->default_group;
$vars->{serveradmin} ||= $self->default_serveradmin;
- $vars->{maxclients} ||= 1;
+ $vars->{minclients} ||= 1;
+ $vars->{maxclients} ||= $vars->{minclients} + 1;
$vars->{proxy} ||= 'off';
$vars->{proxyssl_url} ||= '';
$vars->{defines} ||= '';
@@ -403,6 +405,7 @@


     #if we proxy to ourselves, must bump the maxclients
     if ($vars->{proxy} =~ /^on$/i) {
+        $vars->{minclients}++;
         $vars->{maxclients}++;
         $vars->{proxy} = $self->{vhosts}->{'mod_proxy'}->{hostport};
         return $vars->{proxy};
@@ -1183,6 +1186,7 @@
         }

         if ($vars->{proxyssl_url}) {
+            $vars->{minclients}++;
             $vars->{maxclients}++;
         }
     }
@@ -1849,30 +1853,34 @@

 <IfModule @THREAD_MODULE@>
     StartServers         1
+    MinSpareThreads      @MinClients@
+    MaxSpareThreads      @MinClients@
+    ThreadsPerChild      @MinClients@
     MaxClients           @MaxClients@
-    MinSpareThreads      @MaxClients@
-    MaxSpareThreads      @MaxClients@
-    ThreadsPerChild      @MaxClients@
     MaxRequestsPerChild  0
 </IfModule>

 <IfModule perchild.c>
     NumServers           1
-    StartThreads         @MaxClients@
-    MinSpareThreads      @MaxClients@
-    MaxSpareThreads      @MaxClients@
+    StartThreads         @MinClients@
+    MinSpareThreads      @MinClients@
+    MaxSpareThreads      @MinClients@
     MaxThreadsPerChild   @MaxClients@
     MaxRequestsPerChild  0
 </IfModule>

 <IfModule prefork.c>
-    StartServers         1
+    StartServers         @MinClients@
+    MinSpareServers      @MinClients@
+    MaxSpareServers      @MinClients@
     MaxClients           @MaxClients@
     MaxRequestsPerChild  0
 </IfModule>

 <IfDefine APACHE1>
-    StartServers         1
+    StartServers         @MinClients@
+    MinSpareServers      @MinClients@
+    MaxSpareServers      @MinClients@
     MaxClients           @MaxClients@
     MaxRequestsPerChild  0
 </IfDefine>
Index: ModPerl-Registry/t/TEST.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/t/TEST.PL,v
retrieving revision 1.14
diff -u -r1.14 TEST.PL
--- ModPerl-Registry/t/TEST.PL  6 Mar 2004 01:52:47 -0000       1.14
+++ ModPerl-Registry/t/TEST.PL  26 Apr 2004 22:29:09 -0000
@@ -16,7 +16,7 @@
 use base qw(Apache::TestRunPerl);

 # redirect tests require 2 servers
-use constant MIN_MAXCLIENTS => 2;
+use constant MIN_CLIENTS => 2;

 use File::Spec::Functions qw(catdir);
 use File::Basename qw(dirname);
@@ -42,7 +42,7 @@
         $ENV{APACHE_TEST_STARTUP_TIMEOUT} ||
         DEFAULT_STARTUP_TIMEOUT;

-    $self->{conf_opts}->{maxclients} ||= MIN_MAXCLIENTS;
+    $self->{conf_opts}->{minclients} ||= MIN_CLIENTS;

     return $self->SUPER::new_test_config;
 }
Index: lib/ModPerl/TestRun.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/ModPerl/TestRun.pm,v
retrieving revision 1.20
diff -u -r1.20 TestRun.pm
--- lib/ModPerl/TestRun.pm      5 Mar 2004 02:42:32 -0000       1.20
+++ lib/ModPerl/TestRun.pm      26 Apr 2004 22:29:13 -0000
@@ -24,7 +24,7 @@
 # some mp2 tests require more than one server instance to be available
 # without which the server may hang, waiting for the single server
 # become available
-use constant MIN_MAXCLIENTS => 2;
+use constant MIN_CLIENTS => 2;

 sub new_test_config {
     my $self = shift;
@@ -35,7 +35,7 @@
         $ENV{APACHE_TEST_STARTUP_TIMEOUT} ||
         Apache::Build->build_config->mpm_is_threaded() ? 300 : 120;

-    $self->{conf_opts}->{maxclients} ||= MIN_MAXCLIENTS;
+    $self->{conf_opts}->{minclients} ||= MIN_CLIENTS;

     ModPerl::TestConfig->new($self->{conf_opts});
 }



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to