[zeromq-dev] Assertion failure in mailbox.cpp

Matt Connolly matt.connolly at me.com
Tue May 20 01:45:05 CEST 2014

On 19 May 2014, at 11:51 pm, Jon Gjengset <jon at thesquareplanet.com> wrote:

>>> In the rbczmq gem, I decided to put a mutex around any calls to close
>>> a socket so only one could happen at a time. This incurs a performance
>>> hit for applications opening and closing many sockets - but I
>>> understand that is not a recommended usage pattern.
>> If there is a race condition between the closing of different sockets
>> belonging to the same context, then this should be documented, and
>> potentially fixed. While I could add a mutex around the closing as you
>> say, I'd really rather not; part of the reason I wanted to move to ØMQ
>> in the first place was to get rid of unnecessary locks.
> I tried adding a mutex around every call to zmq_close now, and the
> assertion still fails, so it seems like this is not a close-close race.
> Since the assertion fail happens in a recv call, it looks more like a
> close-recv problem?

Another thought: Have you tried setting the linger option in the socket before closing them? CZMQ does this automatically:



More information about the zeromq-dev mailing list