Steve Hay wrote:
Bill Stoddard wrote:


Just committed a fix (please test) to Apache HTTPD 2.1. Patch is here (it should apply to 2.0):

http://cvs.apache.org/viewcvs.cgi/httpd-2.0/server/mpm/winnt/child.c?r1=1.32&r2=1.33



Brilliant! That's fixed it straight away -- the mp2 1.99_13 test suite with all 21 Listen's but only 20 ThreadsPerChild now runs perfectly.


(Actually, it works fine with only 1 ThreadsPerChild now!!!)

It still says it only started 20 threads, though (in error_log). Is that correct? I thought the plan was to bump ThreadsPerChild up, so I was expecting to see an extra thread started. Or is it that ThreadsPerChild threads are still created initially, and up to num_listeners extra threads can now be created later if required.

Perhaps a documentation change would be in order too, to mention the effect that the number of listeners now has on ThreadsPerChild?

Can this entry appear at the end of httpd.conf?


<IfModule mpm_winnt.c>
    ThreadsPerChild      20
    MaxRequestsPerChild  0
</IfModule>

if so, this patch should do the right thing. If not, a big rewrite will be required as at the moment we don't know the number of listeners when the top of httpd.conf is written.

Index: lib/Apache/TestConfig.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.213
diff -u -r1.213 TestConfig.pm
--- lib/Apache/TestConfig.pm 4 Mar 2004 05:51:31 -0000 1.213
+++ lib/Apache/TestConfig.pm 10 Mar 2004 18:57:07 -0000
@@ -973,6 +973,13 @@
$self->server->version_of(\%servername_config)->(@_);
}


+my $vhost_listeners = 0;
+sub vhost_listeners {
+    my($self, $increment) = @_;
+    $vhost_listeners++ if $increment;
+    $vhost_listeners;
+}
+
 sub parse_vhost {
     my($self, $line) = @_;

@@ -1019,6 +1026,8 @@
         #extra config that should go *outside* the <VirtualHost ...>
         @out_config = ([Listen => $vars->{servername} . ':' . $port]);

+        $self->vhost_listeners(1);
+
         if ($self->{vhosts}->{$module}->{namebased}) {
             push @out_config => [NameVirtualHost => "*:$port"];
         }
@@ -1395,6 +1404,20 @@

$self->postamble_run($out);

+    # Apache2 (< 2.0.50) winnt mpm requires at least as many threads
+    # as the number of listeners, which we don't know until all config
+    # hooks were called, so only at this point we can write ThreadsPerChild
+    if ($self->server->{rev} == 2 && $self->{mpm} eq 'winnt') {
+        my $threads = $self->{vars}->{maxclients} + $self->vhost_listeners();
+    print $out <<EOI;
+<IfModule mpm_winnt.c>
+    ThreadsPerChild      $threads
+    MaxRequestsPerChild  0
+</IfModule>
+
+EOI
+    }
+
     print $out join "\n", @very_last_postamble;

     close $in;
@@ -1840,10 +1863,7 @@
     MaxRequestsPerChild  0
 </IfDefine>

-<IfModule mpm_winnt.c>
-    ThreadsPerChild      20
-    MaxRequestsPerChild  0
-</IfModule>
+

<Location /server-info>
SetHandler server-info
Index: lib/Apache/TestConfigPerl.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigPerl.pm,v
retrieving revision 1.84
diff -u -r1.84 TestConfigPerl.pm
--- lib/Apache/TestConfigPerl.pm 4 Mar 2004 05:51:31 -0000 1.84
+++ lib/Apache/TestConfigPerl.pm 10 Mar 2004 18:57:07 -0000
@@ -222,6 +222,7 @@
my($self, $module, $args) = @_;
my $port = $self->new_vhost($module);
my $vars = $self->{vars};
+ $self->vhost_listeners(1);
$self->postamble(Listen => $vars->{servername} . ':' . $port);
}



-- __________________________________________________________________ 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

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to