[zeromq-dev] Even more fun with accept

Pieter Hintjens ph at imatix.com
Thu Apr 30 10:58:04 CEST 2009

On Wed, Apr 29, 2009 at 6:27 PM, Martin Sustrik <sustrik at fastmq.com> wrote:

> The consequence is that polling on the listening socket signalises that
> there's a pending connection, however, there's no way to accept it
> unless some sockets are closed in the meantime.

You might want to discuss this with Mato Lucina, we just fixed the
exact same situation in OpenAMQ.

First, the socket limit is system dependent, on some like AIX it is a
pretty low per-process limit that needs to be increased for any real
use.  Thus it's worth complaining loudly so that the user knows the
process has hit a ceiling that must be moved.

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.

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.


More information about the zeromq-dev mailing list