[zeromq-dev] FW: zmq hangs

Chuck Remes cremes.devlist at mac.com
Wed Nov 2 18:28:43 CET 2011

On Nov 2, 2011, at 12:03 PM, Alexander Altshuler wrote:

> On Nov 2, 2011, at 7:47 PM, Chuck Remes wrote:
>> Read this section of the guide:  http://zguide.zeromq.org/page:all#-MQ
>> 1. Make sure all sockets set ZM_LINGER to 0 or a positive integer.
>> 2. When zmq_term() is called, any sockets blocking on a read or write
> will 
>> be interrupted and return -1. Check zmq_errno() to see if the value is
>> EINTR. If so, close the socket with zmq_close().
>> zmq_term() will hang forever unless all sockets are closed, and
> sockets > > won't close unless LINGER is set to 0 or higher.
>> I hope that helps.
> Sorry I did not correctly explain the problem.
> My server has "forever" cycle. 
> It sends heartbeat message by PUB socket every seconds. It also does
> some other simple work.
> But when client application terminates server hangs in zmq_sendmsg()
> function.

The man page for zmq_socket() says that a PUB socket should never block in zmq_send() or zmq_sendmsg(). If you are seeing this behavior, it is a bug. It should be very simple to reproduce. Can you write a small C program that shows this behavior?


More information about the zeromq-dev mailing list