public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* TCP_DEFER_ACCEPT issues
@ 2007-11-02  1:33 Felix von Leitner
  2007-11-02  2:51 ` David Miller
  2007-11-02  7:24 ` Eric Dumazet
  0 siblings, 2 replies; 5+ messages in thread
From: Felix von Leitner @ 2007-11-02  1:33 UTC (permalink / raw)
  To: linux-kernel

I am trying to use TCP_DEFER_ACCEPT in my web server.

There are some operational problems.  First of all: timeout handling.  I
would like to be able to set a timeout in seconds (or better:
milliseconds) for how long the socket is allowed to sit there without
data coming in.  For high load situations, I have been enforcing
timeouts in the range of 15 seconds, otherwise someone can DoS the
server by opening a lot of connections and tying up data structures.

It is still possible, of course, to tie up kernel memory this way, by
not reacting to the FIN or RST packets and running into a timeout there,
too, but that is partially tunable via sysctl.

According to tcp(7) the int argument to TCP_DEFER_ACCEPT is in seconds.
In the kernel code, it's converted to TCP timeout units.  When I ran my
server, and connected without sending any data, nothing happened.  No
timeout.  Minutes later, the connection was still there.  Even worse:
when I killed (!) the server process (thus closing the server socket),
the client did not get a reset.  Only when I type something in the
telnet, I get a reset.  This appears to be very broken.

My suggestion:

  1. make the argument to the setsockopt be in seconds, or milliseconds.
  2. if the server socket is closed, reset all pending connections.

Comments?

Felix

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

end of thread, other threads:[~2007-11-04 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-02  1:33 TCP_DEFER_ACCEPT issues Felix von Leitner
2007-11-02  2:51 ` David Miller
2007-11-02  7:24 ` Eric Dumazet
2007-11-02 22:19   ` Felix von Leitner
2007-11-04 17:18     ` dean gaudet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox