[zeromq-dev] auto-reconnect failure

Martin Sustrik sustrik at fastmq.com
Mon Mar 9 16:41:46 CET 2009


The bug is pretty strange, possibly caused by inter-thread interactions. 
The error handler is called in 0MQ's private thread and thus you should 
do any synchronisation by hand in case you are accessing any shared 

Try this:

1. Don't use error handler at all, rather ask 0MQ to send you 
disconnection notifications: api->mask (message_gap), then check the 
incoming messages whether they are real messages or just reconnection 
notifications: if (msg.type () == message_gap) ...

2. If you want reconnect to work properly you need to specify the port 
number. So when declaring the global exchange use "" 
rather than "".


Aamir Mohammad wrote:
> Hello,
> I have a program called "sender" that is publishing messages to a
> global exchange and a program called "'receiver" that binds a local
> queue to the global exchange. If I start both programs and then kill
> the receiver process, the sender's error_handler function is called
> ... since I return true in error_handler, the sender program does not
> crash and continues to publish messages. But then if I restart the
> receiver program, the receiver's error_handler method is called
> repeatedly while the sender process crashes with the following
> message:
> api_thread.cpp:377: void zmq::api_thread_t::process_command(const
> zmq::command_t&): Assertion `false' failed. Aborted
> Has anyone seen this problem before?
> Thanks
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list