*** There is an attachment in this mail. ***
_____________________________________________________________
--- Begin Message ---
I'm using the LWP::UserAgent for a small tcp/ip client/server application I've
written. All that the client does is query a small http server I've written on a
different host. It works.
However, after a couple thousand connections, I notice the client(s) stop getting info
from the server. They continue to run, but when I look at netstat, I see a high
number of clients stuck in the FIN_WAIT_2 state (the second part of the disconnection
sequence). They don't seem to come out of this state. Concurrent with this problem,
I notice error messages from the client something like:
Can't locate LWP/Authen/Negotiate.pm in @INC ...
Can't locate LWP/Authen/Ntlm.pm in @INC ...
But these errors only come up after the application has run for a long time, and seem
to also coincide with a lot of waiting processes which haven't disconnected.
Here is the rough-code for the small, custom web server. It's a single-process,
no-threads, doesn't fork, etc.. I'm running FreeBSD 4.3 on both client and server
system. Has anyone had problems like this before? I've been looking through
Stephen's Unix Network Programming, and there are small references to things like
shutting down sockets rather than closing them. Or that on BSD, there is a roughly 11
minute timeout for FIN_WAIT_2 states. Is there a sysctl variable I can set to
decrease this? Am I running out of descriptors when too many get locked in
FIN_WAIT_2, and is that why I can't successfully request?
Any info or ideas would be appreciated. Thank you,
--Ben
my $socket=IO::Socket::INET->new ( LocalPort => $port,
Listen => SOMAXCONN,
Reuse => 1 ) or die "oops: $!";
while (#some continuation conditions#) {
eval {
local $SIG{HUP}=sub{$done++; die;};
($c,$remote_addr)=$socket->accept;
};
local $/ = "\015\012\015\012";
$req=<$c>;
if ($c) {
#do some stuff and print back to $c#
close $c;
}
}
close($socket);
_____________________________________________________________
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: [EMAIL PROTECTED] PROBLEMS: [EMAIL PROTECTED]
Subscriptions; Email to [EMAIL PROTECTED]: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/
--- End Message ---