[zeromq-dev] [bug+workaround] socket_t not closed properly, still used

Martin Sustrik sustrik at 250bpm.com
Fri Jan 21 14:54:56 CET 2011

On 01/21/2011 01:52 PM, Thijs Terlouw wrote:
> On Fri, Jan 21, 2011 at 8:13 PM, Martin Sustrik<sustrik at 250bpm.com>  wrote:

> 2) I didn't debug the 2nd part detailedly, but I suspect indeed that
> untill when the socket_t is destructed, the peer still sends messages
> to it - which will then all fail (no reply). That's at least the
> symptom I was seeing in my application. This part is the real nasty
> bug.

Also note that this problem cannot be really solved. When you invoke 
zmq_close() there may be some messages already queued in the socket and 
thus they are dropped instead of received.

The solution exists on higher level and seems to depend on the messaging 

1. PUB/SUB - Drop the messages.
2. REQ/REP - Requester should resend the request after timeout has 
expired. That way it can compensate for lost requests or replies.
3. PUSH/PULL - Implementing a 0mq-level ACKs could possibly help here.


More information about the zeromq-dev mailing list