[zeromq-dev] Even more fun with accept
Erich Heine
sophacles at gmail.com
Thu Apr 30 17:35:50 CEST 2009
On Thu, Apr 30, 2009 at 3:58 AM, Pieter Hintjens <ph at imatix.com> wrote:
>
> <SNIP>
> Second, Unix has an interesting strategy for dealing with closed
> sockets, namely to keep them around for a minute or so. This means
> that you will often hit this ceiling when in fact there should be
> sockets available but they are not yet purged. Thus a sensible
> strategy for recovering is to wait for a while (60 seconds) before
> accepting new sockets.
>
This isn't a Unix/posix specific thing. Its part of the TCP standard and is
called TIME_WAIT. The problem is because TIME_WAIT exists to deal with
"just in case" data arrival, it ties up a descriptor on Unix because of the
semantics of both. (Also because socket semantics on unix were pretty well
established before people really realized that TIME_WAIT sockets tying up
descriptors is useless in a large proportion of the cases, hence newer OSes
allowing you to tweak the time_wait timeout independently and out of spec).
A good reference on this is:
http://www.developerweb.net/forum/showthread.php?t=2941
This reference does assume some familiarity with the TCP state machine.
>
> Knowing in advance your system's limits will let you avoid getting the
> error but it won't change the outcome - you still need to warn the
> user loudly, and you still need to wait before doing further accepts.
I very much agree with this suggestion.
Regards,
Erich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20090430/3dbda338/attachment.htm>
More information about the zeromq-dev
mailing list