web-server port leak? was: [plt-scheme] Resource management in the web server

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Fri Oct 13 10:11:26 EDT 2006

When I check on the Continue server it doesn't have any dormant ports,
but we may be experiencing different clients.

Can you send me your Apache set up, or use wireshark to trace a
connection. Maybe Apache's mod_proxy is using odd headers that I don't
handle to signify Keep-Alive.

Jay

On 10/13/06, Noel Welsh <noelwelsh at yahoo.com> wrote:
> --- Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>
> > Here's the custodian hierarchy in the web server:
> >
> > root custodian
> > |--- server custodian
> >        |--- connection custodian
> >        |--- ...
> >        |--- servlet custodian
> >                    |--- instance custodian
> >                    |--- ...
> >        |--- ....
>
> ...
>
> Thanks.  I've solved some of my problems with port leaks.
> However it appears the web server is leaking ports.  In my
> setup the web-server sits behind Apache, which passes on
> requests using mod_proxy.  Of the course of a day about 20
> sockets accumulate.  Netstat shows the following sockets
> opened by the web-server:
>
> Proto Recv-Q Send-Q Local Address           Foreign Address
>         State
> tcp        1      0 localhost:8765          localhost:60715
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:60713
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:41991
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:51210
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:51211
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:60946
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:56080
>         CLOSE_WAIT
> tcp        1      0 localhost:8765          localhost:58976
>         CLOSE_WAIT
> etc.
>
> The netstat man page says:
>
>  CLOSE_WAIT
>     The remote end has shut down, waiting for the socket to
> close.
>
> So it appears that the web-server is failing to shutdown
> these sockets.  There is a OS level shutdown timer
> associated with each socket, but it's value is 0, which I
> think means the timer will never go off and so the socket
> will never be closed by the OS.
>
> Searching on the Interweb shows this a fairly common
> problem, often associated with (HTTP/1.1) Keep-alive.  So
> perhaps the web-server does not implement HTTP/1.1 and/or
> Keep-alive fully?
>
> The system is Linux running MzScheme 352.5.
>
> Thanks,
> Noel
>
> Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
> AIM: noelhwelsh
> Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


-- 
Jay McCarthy <jay.mccarthy at gmail.com>
http://jay.teammccarthy.org


Posted on the users mailing list.