[zeromq-dev] Pub/sub, inproc shutdown Assert failure

Martin Hurton hurtonm at gmail.com
Sun Jun 10 19:39:04 CEST 2012


Hi Marc,

1) could you create an issue
2) could you put together minimal C program reproducing this bug and
make pull request so it finds its way into issues repo

Thanks, martin

On Sat, Jun 9, 2012 at 9:19 PM, Marc Criley <mcriley.1979 at gmail.com> wrote:
> I'm getting:
>
> Assertion failed: ok (mailbox.cpp:79)
>
> when trying to shut down my application. After having searched the archives
> and whitepapers I'm still at a loss. Here's the structure of what I have and
> am trying to do (version 2.1.9-1, distributed with Ubuntu):
>
> - One main thread establishes a PUB socket using the 'inproc' transport.
> - Four separate threads each open a SUB socket.
> - 'inproc' requires the pub and sub sockets to use the same context, so that
> is done.
> - Each subscriber socket waits on 'recv()' for something to arrive, which is
> then processed, and returns back to waiting for the next message.
>
> Everything runs fine in the application. However, at shutdown:
>
> - There is no pending traffic, it has all been cleared.
> - The main thread closes its PUB socket.
> - The main thread invokes zmq_term, which blocks.
> - This unblocks the four subscriber threads waiting on recv().
> - Each subscriber thread closes its socket and the thread terminates.
>
> At this point I expect the main thread call of zmq_term() to complete.
> That's not what happens, instead I get:
>
> Assertion failed: ok (mailbox.cpp:79)
>
> I believe I did this in accordance with the 0MQ Termination whitepaper
> (http://www.zeromq.org/whitepapers:0mq-termination), and this is the
> sequence I use to shutdown a tcp transport client thread, which works
> without problem.
>
> Deferring closing the PUB socket until after zmq_term doesn't work, as
> zmq_term blocks until the socket is closed.
>
> Any suggestions would be appreciated.
>
> Marc C
>
>
> _______________________________________________
> 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