Subject: | Socket not closing on Connection Drop |
I think I'm seeing an edge case resource leak in PoCo::Server::SOAP
(or perhaps ::Server::SimpleHTTP , which handles the network interface
for ::SOAP) .
I have a monitoring system which connects to my daemon to make sure
the TCP socket is still connecting. The monitor just checks for
socket open, and then closes the socket without sending input or
recv'ing output.
this connection is leaving a socket stuck open on the server side in
CLOSE_WAIT state.
turning on TRACE_DEFAULT, I see in the closing heap-scan that the
SimpleHTTP object is building up REQUEST id's , with undef'd and 0'd
items.
if the server gets any data, the info gets into the SimpleHTTP
handler, and the connection is closed cleanly.
it's just this edge case where there's nothing to read from the socket
where the server-side isn't closing out cleanly if the client side
closes.
using POE-Component-Server-SOAP-1.10/examples/test-server.perl
1) run test-server.pl
2) telnet to localhost:32080
3) ^] escape out of telnet, and close the session
4) lsof on the test-server.pl pid shows the stuck socket:
perl 13566 jer 4u IPv4 88567728 TCP
localhost.localdomain:32080->localhost.localdomain:39865 (CLOSE_WAIT)
running test-server.pl with TRACE_DEFAULT , the Heap dump on exit shows
that Requests is still populated, and exiting dies with:
Can't call method "connection" on an undefined value at
/usr/local/share/perl/5.8.4/POE/Component/Server/SimpleHTTP.pm line 275.
foreach my $req ( keys %{ $_[HEAP]->{'REQUESTS'} } ) {
# Bite the programmer!
warn 'Did not get DONE/CLOSE event for Wheel ID ' . $req . ' from
IP ' . $_[HEAP]->{'REQUESTS'}->{ $req }->[2]->connection->remote_ip;
}
POE 0.9917 , PoCo::Server::SOAP 1.10 , PoCo::Server::SimpleHTTP 1.19.
reproduced under Linux 2.4 and Solaris 2.6 .
perl v5.8.4 built for i386-linux-thread-multi,
perl v5.8.8 built for sun4-solaris-thread-multi , respectfully.