I've tried searching the archives for my particular problem but haven't
found anything, hence this email.
Problem:
I'm seeing that every call using LWP to any SSL site causes tcp sockets to
linger (indefinitely) in CLOSE_WAIT state when I use mod_perl. mod_perl
being "long lived", this problem manifested itself by LWP reporting 500
errors Can't connect to sitename (Bad protocol 'tcp'). Looking at the
output of netstat -tanp | grep -i close_wait we could see thousands of tcp
sockets in CLOSE_WAIT state. I have confirmed with a simple test case that
every hit corresponds to a new tcp socket in CLOSE_WAIT state. The 500
errors started appearing once the number of sockets reached some kind of
kernel limit. Restarting mod_perl promptly cleared up all those
CLOSE_WAITs.
Versions:
Gentoo Linux on kernel version 2.4.20-ck6
apache 2.0.46
LWP 5.69
IO::Socket:SSL 0.92 (tried 0.94 as well with no respite)
mod_perl 1.99_09
perl 5.8.0
How to reproduce:
You must be running mod_perl. I was not able to reproduce this bug in CGI
mode. You must be trying to access an SSL site. I was not able to
reproduce this bug with non-SSL sites. Here's a simple test mod_perl
script.
#!/usr/bin/perl
use strict;
my $r = shift;
$r->content_type('text/html');
use LWP::UserAgent;
use HTTP::Request::Common qw(GET);
my $ua = new LWP::UserAgent;
my $req;
my $res;
my $URL = 'https://www.rosi.utoronto.ca/';
$req = GET $URL;
$res = $ua->request($req);
print
$res->is_success ?
$res->content :
'Error while getting ' . $res->request->uri . ' ' . $res->status_line;
After installing this on a mod_perl server every hit to this script will
cause a CLOSE_WAIT to appear in your netstat output.
Workaround:
I was able to use regular http instead of https as a workaround but this
is bound to bite somebody else at a future date.
Can I provide any more information? I can also take this to the mod_perl
list but I'm almost positive this is not mod_perl's problem. mod_perl in
this case helped bring the bug to surface.
Regards,
--
Haroon Rafique
<[EMAIL PROTECTED]>