Question about SO_LINGER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux