[zeromq-dev] How to do reliable fire and forget with a HWM?

Schaller, Edward B schallee at lanl.gov
Fri Sep 2 23:06:06 CEST 2011

> Have a look at ZMQ_LINGER option:

Thanks for the reply!

Sadly, this actually doesn't work and is the reason for the bug. I forgot to mention it in my email but did in the bug report.

The documentation for ZMQ_LINGER states:

The default value of -1 specifies an infinite linger period. Pending messages shall not be discarded after a call to zmq_close(); attempting to terminate the socket's context with zmq_term() shall block until all pending messages have been sent to a peer.

By default this is -1 and this is the documentation that is contrary to the behavior exhibited. I have explicitly setting ZMQ_LINGER to -1 and validated that it is set to -1 and still loose messages.

Martin commented on the bug:

"The problem is that the message that cannot be written to the pipe because of HWM is kept in the engine. If disconnection happens in such situation, engine is closed and the message is lost."

Example code (both mine and Martin's) is attached to the bug. I'm hoping there is a way around the bug.



More information about the zeromq-dev mailing list