All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about SO_LINGER
@ 2005-08-11  0:50 steve roussey
  2005-08-11  1:20 ` David S. Miller
  2005-08-14  0:22 ` dean gaudet
  0 siblings, 2 replies; 3+ messages in thread
From: steve roussey @ 2005-08-11  0:50 UTC (permalink / raw)
  To: linux-kernel

In a conversation the other yesterday about web servers, this came up
in conversation by another much more informed than I. I'm not sure if
the information is up to date to current kernel builds, so I pose the
question here: Does the linux kernel block on SO_LINGER?

Here is paragraph in the other conversation:

"The big problem is that most operating systems, for reasons I have never
understood, block on the close when SO_LINGER is set on it.  I always
thought that made absolutely no sense and is something the damn kernel's
stack should just take care of, but it doesn't, and you end up sitting
around twiddling your thumbs in userspace waiting for the lingering
socket to shut down.  Apache has a workaround called lingering_close()
that tries to address broken SO_LINGER implementations, but it also blocks."

I was guessing (but did not ask) that this information came from
apache so I grabbed this from apache's comments:

 * In an ideal world, this function would be accomplished by simply
 * setting the socket option SO_LINGER and handling it within the
 * server's TCP stack while the process continues on to the next request.
 * Unfortunately, it seems that most (if not all) operating systems
 * block the server process on close() when SO_LINGER is used.
 * For those that don't, see USE_SO_LINGER below.  For the rest,
 * we have created a home-brew lingering_close.

But when I looked at when this was added, it was around Apache 1.2
(and it references problems with Linux 2.0.31 -- that is has SO_LINGER
but it is faster/better to not use it). Apache 2.x has all of Apache
1.x's comments about this, though their implementation is different
and doesn't match. I'm going to ask them when I get a definitive
answer here.

Thanks,
-steve--

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about SO_LINGER
  2005-08-11  0:50 Question about SO_LINGER steve roussey
@ 2005-08-11  1:20 ` David S. Miller
  2005-08-14  0:22 ` dean gaudet
  1 sibling, 0 replies; 3+ messages in thread
From: David S. Miller @ 2005-08-11  1:20 UTC (permalink / raw)
  To: iamstever; +Cc: linux-kernel


If you want an expediant answer to a networking related
kernel question, you may wish to post this to
netdev@vger.kernel.org which (unlike here) is where the
kernel networking developers are subscribed.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question about SO_LINGER
  2005-08-11  0:50 Question about SO_LINGER steve roussey
  2005-08-11  1:20 ` David S. Miller
@ 2005-08-14  0:22 ` dean gaudet
  1 sibling, 0 replies; 3+ messages in thread
From: dean gaudet @ 2005-08-14  0:22 UTC (permalink / raw)
  To: steve roussey; +Cc: linux-kernel

On Wed, 10 Aug 2005, steve roussey wrote:

> socket to shut down.  Apache has a workaround called lingering_close()
> that tries to address broken SO_LINGER implementations, but it also blocks."

apache 1.x is single threaded / forked, so yeah it blocks.  the 
implementation is there because very few SO_LINGER implementations 
actually worked in the 90s.  the method used by apache 1.x is easy to 
modify into a non-blocking form... which could be how they did it in 2.x 
(i stopped hacking on apache sometime early in 2.x development).

-dean

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-14  0:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-11  0:50 Question about SO_LINGER steve roussey
2005-08-11  1:20 ` David S. Miller
2005-08-14  0:22 ` dean gaudet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.