[zeromq-dev] Assertion failed: ok (mailbox.cpp:84)

Marcin Olak marcin.olak at gmail.com
Fri Feb 10 23:40:46 CET 2012

Hi guys,

In my system under heavy load and heavy socket creation/destruction an assertion 
in mailbox.cpp:84 (zeromq-2.1.11) aborts the program. Any clues why this might 

Setup I have is this:
* 1400 threads, each owning a single REQ socket connected via inproc to queue 
device that is load balancing requests to a bunch of remote servers via tcp,
* max_sockets in src/config.cpp is set to 1500,
* I'm not migrating sockets across threads,
* each socket is created using same context initialized with zmq_init(1),
* in case of recv timeout I tear down a REQ socket.

Usual advice in regard to this assertion is - "zmq sockets are not thread safe - 
use the socket in a single thread". I'm not (at least conciously) using them in 
multithreaded way. But assuming this is the reason any advices how could I trace 
down the culprits? I used following techniques:

* I tried to catch the race condition red-handed using jinx debugger but to no 
* I stuffed base_socket_t and mailbox with debug messages about current thread 
touching these objects and the socket for which assertion is triggered has been 
touched only by a single thread.

Any advice will be greatly appreciated because. I'm basically banging my head 
against the wall after week of bug hunting...

Marcin Olak

More information about the zeromq-dev mailing list