The sockets aren't completely open, they are in the CLOSE_WAIT state, so Firefox may have closed the socket on the remote side (and sent a FIN), but the local application has yet to close the socket.
-----Original Message----- From: Rocco Caputo [mailto:[EMAIL PROTECTED] Sent: Friday, March 23, 2007 9:26 PM To: POE List Subject: Re: POE::Component::Server::HTTP, Keep alive, and leaking sockets Something doesn't add up. Maybe I'm missing a pertinent fact. On one hand, if sockets are being kept alive between requests, why is Firefox opening a new socket for each request? On the other hand, if Firefox is opening a new socket for each request, why isn't it closing the old ones? Why isn't Firefox also running out of file descriptors, if it's opening new sockets without closing old ones? -- Rocco Caputo - [EMAIL PROTECTED] On Mar 21, 2007, at 15:50, Eric Busto wrote: > Firefox seems to keep them alive as well. Unfortunately, since the > app > I am writing uses a meta refresh every few seconds to have the browser > reload it, a browser left up overnight will easily cause the app to > run > out of file descriptors. > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Mathieu Longtin > Sent: Wednesday, March 21, 2007 12:27 PM > To: Eric Busto > Cc: poe@perl.org > Subject: Re: POE::Component::Server::HTTP, Keep alive, and > leaking sockets > > > My memory is fuzzy, but I think if you close the browser, > especially if it's local, the sockets closes. I remember IE keeping > the > connections alive for a while. > > > On 3/21/07, Eric Busto <[EMAIL PROTECTED]> wrote: > > From what I have gathered, for a web server to be HTTP > 1.1 compliant, it > must support keep alive, and keep alive is enabled by > default. > > When using POE::Component::Server::HTTP in its simple > case, as in the > cookbook entry > > http://poe.perl.org/?POE_Cookbook/Web_Server_With_Components, keeping > the connections open even after the event for the URL > request has been > handled causes file descriptors to "leak" as the socket > will not get > closed. > > I can force the connection to get closed after the > ContentHandler > triggers by having a PreHandler like so: > POE::Component::Server::HTTP->new ( > Port => 80, > PreHandler => { > '/' => sub { > $_[0]->header(Connection => > 'close') } > }, > ContentHandler => { > '/' => \&web_status, > } > } > > My question is, is this the "right" thing to do? Is > there a more > elegant method, or am I missing something that should be > obvious? If > I'm not missing anything, should this be added to the > cookbook page for > a basic web server with PoCo::Server::HTTP? ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -----------------------------------------------------------------------------------