httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Korthof>
Subject Re: lingering_close / SO_LINGER
Date Thu, 06 Jul 2000 22:14:04 GMT
On Thu, 6 Jul 2000, Bill Stoddard wrote:

> > 1) is there an equivalent to lingering_close, in APR, which i missed?
> > (quite possible, i didn't look too closely.)
> No. ap_lingering_close() is still an Apache function that resides in
> http_connection.c.

ah, thanks for pointing this out.  so -- why is this in apache instead of
apr?  perhaps it's not useful for all servers, but it seems that the logic
for this out to occur in the same place as that used SO_LINGER -- APR is
supposed to be the place for platform-specific code, right?

> > 2) is SO_LINGER safe everywhere, or is something like lingering_close (in
> > Apache 1.3.x) still needed?  based on what i've read recently, i'm
> > guessing the latter...
> SO_LINGER is not implemented correctly on most systems (that is the concensus, I cannot
> say this with certainty from personal experience. SO_LINGER does seem to work correctly
> Windows though). ap_lingering_close() does an explicit shutdown of the connection in
> directions, then waits a while (using select) for any further packets received from the
> client (which are dumped into the bit bucket), then closes the socket.  If you have any
> doubt about your systems implementation of SO_LINGER, use lingering close. The worst
> can happen is you take a slight performance hit.

according to some documents written about when Apache 1.2 was being
developed, some systems will panic (or react badly) if you do a
half-shutdown as lingering_close does.  (thus the NO_LINGERING_CLOSE
compiler define.)  i dunno if there are any systems for which this is
currently an issue, though.

> > 3) is SO_LINGER somehow being enabled (on platforms where it's safe)?  if
> > so, i'm curious as to how.
> setsockopt() (or ap_setsockopt)
> So yes, lingering close of connections is necessary for all
> webservers, including Apache 2.0. The only question is how you
> implement it, explicitly via ap_lingering_close or using
> setsockopt(SO_LINGER).

looking at http_connection.c, i see where setsockopt is called -- but i
can't find any place where ap_setsocketopt is called.  it seems like that
ought to be fixed -- ap_setsocketopt should be used, right?  i can post a
patch to this, but i'm not too familiar with the code / possible side

thanks --


View raw message