I had a little look into this and found that after about 2500 sockets, new 
sockets are created, but their mailbox’s signaller file descriptors are zero. 
errno at this point is EMFILE (too many open files).

This zero file descriptor causes the assert later when context terminate sends 
a stop message to that socket, the write to the signaller fails. The code in 
errno is 2 (ENOENT). There’s no error checking where the file descriptor is 
created. And even if there was, it’s in the signaller constructor where you 
don’t have a return value.

However, it looks like in signaler.cpp:485 that failed file descriptors are not 
actually set to zero, so zero could be a lucky uninitialised value, in contrast 
to the comment in signaler.hpp:62 that the file descriptors would be -1 if 
unavailable.

haha… setting them to -1 makes the socket create fail. Pull request on it’s way.

-Matt


On 10 Nov 2013, at 8:09 am, Bruno D. Rodrigues <[email protected]> 
wrote:

> I think I got it but need to investigate the Darwin documentation and
> test more. After dinner or tomorrow though.
> 
> 
> 
> --
> Bruno Rodrigues
> Sent from my iPhone
> 
> No dia 09/11/2013, às 21:52, Pieter Hintjens <[email protected]> escreveu:
> 
>> On Sat, Nov 9, 2013 at 10:15 PM, Bruno D. Rodrigues
>> <[email protected]> wrote:
>> 
>>> On the mac, it just creates sockets non stop. I’ve set the limit to 
>>> 128*1024 and it happily creates them all (or fakes it), and then of course 
>>> dies when they are closed, or most probably when they are attempted to be 
>>> used.
>>> 
>>> Will follow the create socket and try to understand what is failing here…
>> 
>> There are at least three different paths in the code
>> (signaller.cpp)... Presumably the error handling in the non-Linux path
>> is wrong.
>> 
>> Curious to see what you turn up.
>> 
>> -Pieter
>> _______________________________________________
>> zeromq-dev mailing list
>> [email protected]
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to