[zeromq-dev] auto-reconnect failure

Aamir M aamirjvm at gmail.com
Mon Mar 9 20:08:53 CET 2009


It was a bug in my code. When creating the exchange I misspecified the
number of handler threads ... the error materialized with this
unexpected behavior.

On Mon, Mar 9, 2009 at 11:41 AM, Martin Sustrik <sustrik at fastmq.com> wrote:
> Aamir,
>
> 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 resources.
>
> 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 "192.168.0.1:5555" rather
> than "192.168.0.1".
>
> Martin
>
> 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