* [ECOS] accept() FreeBSD hangs when out of resources
@ 2007-06-11 21:52 Tad
2007-06-11 22:14 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Tad @ 2007-06-11 21:52 UTC (permalink / raw)
To: ecos-discuss
accept() won't return and won't timeout (>12hrs) when listen() indicates
a new connection, if out of sockets/file-descriptors and all TCP
connections are in ESTABLISHED state.
This affects the athttpd server in particular and probably other TCP
network apps.
Non-blocking the socket with FIONBIO doesn't help.
accept() will return if TCP connections in TIME_WAIT state timeout and
free up connections.
Easy to confirm by sending ~16 connection requests (with posts for
example) to an athttpd server.
This is a big deal, because:
1) Accept blocking when out of resources locks up applications which
then can't shutdown resources.
2) The fix is messy. Is there a better way?
a) attempt to count how many sockets are open (remain)
b) never call accept when within a couple sockets of the max...but since
we're not thread-locked, the sockets could be used up between checking
the count and calling accept.
c) disable the listen socket in subsequent select() calls until sockets
free up. But does the listen socket get other msgs that would be missed?
It would just be nice if accept() returned when out of resources. The
current timeout doesn't work and is set for something like 10*2minutes
in certain cases anyhow.
My other FreeBSD bug posts to bugzilla seem to be ignored, so I won't
bother sending this one there.
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [ECOS] accept() FreeBSD hangs when out of resources
2007-06-11 21:52 [ECOS] accept() FreeBSD hangs when out of resources Tad
@ 2007-06-11 22:14 ` Andrew Lunn
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2007-06-11 22:14 UTC (permalink / raw)
To: Tad; +Cc: ecos-discuss
On Mon, Jun 11, 2007 at 02:15:01PM -0800, Tad wrote:
> accept() won't return and won't timeout (>12hrs) when listen() indicates
> a new connection, if out of sockets/file-descriptors and all TCP
> connections are in ESTABLISHED state.
Where exactly is it blocked. Please could you provide a call stack.
The new fd and socket descriptor appears to be allocated in the fileio
code before the network stack accept function is called. And i don't
see how they can block when out of resources.
> My other FreeBSD bug posts to bugzilla seem to be ignored, so I won't
> bother sending this one there.
The often are, since most of us don't automatically get notification
of there creation and I in particular only poll it once a month or
less.
Andrew
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-06-11 21:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-11 21:52 [ECOS] accept() FreeBSD hangs when out of resources Tad
2007-06-11 22:14 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).