You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Pa...@alcatel.fr on 2005/05/11 15:55:25 UTC

[QUESTION] Browser hangs if multiple requests on the same Perl resource (Apache2, modperl2, Win32)

Hi,

I've got a problem with a modperl-enabled site. I've looked into the doc,
troubleshooting, mailing list archives, but to no avail, so I'm kindly
asking experts help.

Symptom:
----------------
Some users have their browser stalled forever trying to load something from
the server, without ever getting an answer back. Hitting stop and reload
gets the resource immediately.
It looks like it happens only when multiple users are requesting the same
Perl resource at the same time: one of them may not get the response.
It doesn't occur when requesting static content from Apache.
No error or warn shows up in Apache error.log file (PerlWarn is On).

Context:
--------
Server Version: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g
mod_auth_sspi/1.0.1 mod_perl/1.999.21 Perl/v5.8.6 (compiled on Win32 by
myself to have it SSL-enabled)
     (problem also occurs with the official Win32 apache binary distro
2.0.54 from apache.org)
ActiveState Perl 5.8, perl -v shows: perl, v5.8.6 built for
MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more
detail), Built Dec 13 2004 09:52:01
OS is: Windows XP Pro SP1

Investigations:
---------------
To reproduce the problem, I use a basic Perl script (see below), which I
request from another host using ApacheBench with 10 concurrent agents and
requesting 100 times the script. Some of these requests (about 3 out of 100
each time) just stall and timeout after a couple (tens) of seconds (see
trace below).
Note that the longer the script execution is, the easier it is to reproduce
and the less concurrent requests are needed.

I also monitored the Apache process, and it occurs that the child Apache
process has a number of sockets in CLOSE_WAIT state, which is not normal.
The number of CLOSE_WAIT sockets increases each time the problem occurs, and
corresponds to the number of clients that stalled.

Apache mod_status shows this problem too, as it shows a non-zero number of
requests being processed while the server is idle. This number corresponds
to the number of CLOSE_WAIT sockets, plus one (for the mod_status request
itself).

Finally, I sniffed the network and saw a very strange behaviour. A first
ApacheBench run shows that client socket 1471 hangs (no response is sent
back by the server on this socket), timeout occurs and socket becomes
CLOSE_WAIT. A second run shows that Apache server sends a response back to
client socket 1471 (which is CLOSE_WAIT !) so it detects it's closed and
cleans it up, but leaves one the other client socket 1475 hanging... As if
it confused socket 1475 with old socket 1471 ! And the scenario goes over
and over again.

Any idea ?
Thanks in advance,

                              Pascal Davoust.


----Begin C:/Program Files/Apache
Group/Apache2ssl/cgi-bin/mytest.pl----------
##  printenv -- demo CGI program which just prints its environment
  ##
  use strict;
  print "Content-type: text/html\n\n";
  print "<HTML><BODY><H3>Environment variables</H3><UL>";
  foreach (sort keys %ENV) {
    my $val = $ENV{$_};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "<LI>$_ = \"${val}\"</LI>\n";
  }
  #sleep(10);
  print "</UL></BODY></HTML>";
----End mytest.pl----------

----Begin httpd.conf excerpt-------------
PerlWarn On
<Directory "C:/Program Files/Apache Group/Apache2ssl/cgi-bin">
     SetHandler perl-script
     PerlResponseHandler ModPerl::Registry
     Options +ExecCGI
     PerlOptions +ParseHeaders
</Directory>
----End httpd.conf excerpt-------------

----Begin ApacheBench invocation-------------
> ab -c 10 -n 100 http://frcold0061086.col.bsf.alcatel.fr/cgi-bin/mytest.pl
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation,
http://www.apache.org/

Benchmarking frcold0061086.col.bsf.alcatel.fr (be patient)...apr_poll: The
timeout specified has expired (70007)
Total of 97 requests completed

>
----End ApacheBench invocation-------------


RE: [QUESTION] Browser hangs if multiple requests on the same Perlresource (Apache2, modperl2, Win32)

Posted by Pa...@alcatel.fr.
Thanks a million, Stas.

So it looks that this is either a problem on my config parameters, or maybe
that the problem occurs only when running on *Windows* (I'm running Apache2
and modperl2 on WinXP)...

Any hint about what could break in this specific situation ? Or known issues
with Apache2+modperl2 on this platform which is not documented in the
current FAQ and troubleshooting docs of modperl?

Thanks again,

                              Pascal.


Re: [QUESTION] Browser hangs if multiple requests on the same Perlresource (Apache2, modperl2, Win32)

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Pascal.Davoust@alcatel.fr wrote:
> 
>> Hi,
>>
>> I'm still experiencing this problem. Could someone try to reproduce 
>> (this is
>> done in 5mn) so I can be sure it's either my fault or a bug ?
> 
> 
> Pascal, please let me know how to reproduce it and I'll try it.

I've attached the tarball that one could try reproduce the problem with. 
unpack, then:

perl Makefile.PL
t/TEST -conf
t/TEST -start
ab -c 10 -n 100 http://localhost:8529/perl-bin/bug.pl
t/TEST -stop

But no problem on linux:

~/httpd/prefork/bin/ab -c 20 -n 2000 http://localhost:8529/perl-bin/bug.pl
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 200 requests
Completed 400 requests
Completed 600 requests
Completed 800 requests
Completed 1000 requests
Completed 1200 requests
Completed 1400 requests
Completed 1600 requests
Completed 1800 requests
Finished 2000 requests


Server Software:        Apache/2.0.55-dev
Server Hostname:        localhost
Server Port:            8529

Document Path:          /perl-bin/bug.pl
Document Length:        1242 bytes

Concurrency Level:      20
Time taken for tests:   1.834204 seconds
Complete requests:      2000
Failed requests:        0
Write errors:           0
Total transferred:      2901450 bytes
HTML transferred:       2485242 bytes
Requests per second:    1090.39 [#/sec] (mean)
Time per request:       18.342 [ms] (mean)
Time per request:       0.917 [ms] (mean, across all concurrent requests)
Transfer rate:          1544.54 [Kbytes/sec] received

Connection Times (ms)
               min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     2   17   2.5     17      36
Waiting:        1   17   2.4     17      36
Total:          2   17   2.5     17      36

Percentage of the requests served within a certain time (ms)
   50%     17
   66%     18
   75%     18
   80%     19
   90%     21
   95%     23
   98%     24
   99%     25
  100%     36 (longest request)


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

Re: [QUESTION] Browser hangs if multiple requests on the same Perlresource (Apache2, modperl2, Win32)

Posted by Stas Bekman <st...@stason.org>.
Pascal.Davoust@alcatel.fr wrote:
> Hi,
> 
> I'm still experiencing this problem. Could someone try to reproduce (this is
> done in 5mn) so I can be sure it's either my fault or a bug ?

Pascal, please let me know how to reproduce it and I'll try it.


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

RE: [QUESTION] Browser hangs if multiple requests on the same Perlresource (Apache2, modperl2, Win32)

Posted by Pa...@alcatel.fr.
Hi,

I'm still experiencing this problem. Could someone try to reproduce (this is
done in 5mn) so I can be sure it's either my fault or a bug ?

Thanks in advance,

                              Pascal.


RE: [QUESTION] Browser hangs if multiple requests on the same Perlresource (Apache2, modperl2, Win32)

Posted by Pa...@alcatel.fr.
I've just seen thread "Vanishing Requests", and it looks quite close to what
I've witnessed.
mod_log_forensic was suggested in this thread above, so I followed this
suggestion and enabled it.

I restarted Apache and ran ApacheBench twice on a (big) Perl resource with 4
simultaneous requests. Some requests get in Apache but are never responded
back... See IDs Ce7WPqwaKB0AAB4ILmYAAAD2 and DKPMyKwaKB0AAB4ILmoAAAD1 in the
log file below.

This behaviour occurs also on the simplistic Perl script I described in my
original post.

Any suggestion, or steps I can do to troubleshoot further?
Thanks,

                              Pascal.

----- Begin forensic.log --------
+CK-jUawaKB0AAB4ILmIAAAD5|GET /status
HTTP/1.1|Accept:*/*|Accept-Language:en-us|Accept-Encoding:gzip,
deflate|User-Agent:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT
5.0)|Host:frcold0061086.col.bsf.alcatel.fr|Connection:Keep-Alive
-CK-jUawaKB0AAB4ILmIAAAD5
+Ce3iJawaKB0AAB4ILmMAAAD5|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
+Ce4fK6waKB0AAB4ILmQAAAD4|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
+Ce5cMqwaKB0AAB4ILmUAAAD3|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
+Ce7WPqwaKB0AAB4ILmYAAAD2|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
-Ce5cMqwaKB0AAB4ILmUAAAD3
-Ce3iJawaKB0AAB4ILmMAAAD5
-Ce4fK6waKB0AAB4ILmQAAAD4
+DJt07KwaKB0AAB4ILmcAAAD4|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
+DJ5ROKwaKB0AAB4ILmgAAAD5|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
+DKCzd6waKB0AAB4ILmkAAAD3|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
+DKPMyKwaKB0AAB4ILmoAAAD1|GET /bin/view/Archi/WebHome
HTTP/1.0|User-Agent:ApacheBench/2.0.41-dev|Host:frcold0061086.col.bsf.alcate
l.fr|Accept:*/*
-DJ5ROKwaKB0AAB4ILmgAAAD5
-DJt07KwaKB0AAB4ILmcAAAD4
-DKCzd6waKB0AAB4ILmkAAAD3
----- End forensic.log --------


RE: [QUESTION] Browser hangs if multiple requests on the same Perlresource (Apache2, modperl2, Win32)

Posted by Pa...@alcatel.fr.
Yes, it does also happen without mod_sspi. Just tried.

                              Pascal.

-----Message d'origine-----
De : Perrin Harkins [mailto:perrin@elem.com]
Envoyé : mercredi 11 mai 2005 16:54
À : Pascal.Davoust@alcatel.fr
Cc : modperl@perl.apache.org
Objet : Re: [QUESTION] Browser hangs if multiple requests on the same
Perlresource (Apache2, modperl2, Win32)


On Wed, 2005-05-11 at 15:55 +0200, Pascal.Davoust@alcatel.fr wrote:
> Server Version: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g
> mod_auth_sspi/1.0.1 mod_perl/1.999.21 Perl/v5.8.6

Does it happen without mod_auth_sspi?

- Perrin



Re: [QUESTION] Browser hangs if multiple requests on the same Perl resource (Apache2, modperl2, Win32)

Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2005-05-11 at 15:55 +0200, Pascal.Davoust@alcatel.fr wrote:
> Server Version: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.7g
> mod_auth_sspi/1.0.1 mod_perl/1.999.21 Perl/v5.8.6

Does it happen without mod_auth_sspi?

- Perrin