[zeromq-dev] shutdown mutex issue with 2.10

Martin Lucina mato at kotelna.sk
Thu Oct 14 18:41:29 CEST 2010

oliver at kfs.org said:
>   On 10/14/2010 1:33 AM, Martin Sustrik wrote:
> > It's a different scenario. Oliver has a pending message that waits to be
> > sent.
> >
> > Issue 85 has to do with a socket that haven't been closed.
> Hmm - well, in that case, my attempt to duplicate the issue I'm having 
> failed.
> The origin of my problem is that my unit tests are randomly hanging 
> after exit. All of my sends and receives are very carefully matched, or 
> else the unit tests themselves would fail.
> How do I cancel all pending, outgoing messages?
> If there is no way to do this, then ZeroMQ 2.1 is essentially /broken/ 
> for everything except 'C' since the application will hang outside of the 
> programmer's control (above main()). And you've created a situation 
> where flow control is impossible; if I'm communicating with a thread 
> that crashes or tells me it's shutting down, well it's already too late 
> - I already put stuff on the send queue.


This needs a SO_LINGER/ZMQ_LINGER option implemented. The semantics
of this option are that you can set a maximum time a socket should stay
around after it has been zmq_close()d by the application. If you set the
time to 0 and close the socket, it goes away.

This is all in the pipeline but the only person with enough zmq-core-fu to
implement it is probably Martin Sustrik :-)


More information about the zeromq-dev mailing list