Problems with max-sockets in 2.1.0

Description

A number of issues with max-sockets in 2.1.0:

  • The limit seems 1 off, i.e. if I set it to 1000, I can create exactly 999 sockets.

  • Opening 509 sockets provokes an abort in mailbox.cpp:374 on an untuned Linux (508 works).

  • Is the limit of 512 sockets reasonable, given that in 2.0.x it was effectively unlimited? This may break many applications. I'd suggest a rather higher limit (10K?) and explanation in the docs on how to tune for per-process file handle limits.

Sample program to test max-sockets:

// Exhaust file handles per process

#include "zmq.h"
#include "stdio.h"

int main ()
{
void *context = zmq_init (1);

int socket_nbr;
for (socket_nbr = 0; socket_nbr < 8000000; socket_nbr++) {
void *socket = zmq_socket (context, ZMQ_REQ);
if (!socket)
break;
}
printf ("This system allows up to %d sockets\n", socket_nbr);
return 0;
}

Environment

None

Status

Assignee

Unassigned

Reporter

PieterP

Labels

None

Priority