[zeromq-dev] Dropped messages when not sleeping, using 0MQ 2.1.x
Martin Sustrik
sustrik at 250bpm.com
Sun Sep 18 18:22:54 CEST 2011
On 09/18/2011 05:52 PM, James Cipar wrote:
> int linger; size_t l_size = sizeof(linger);
> sender.getsockopt(ZMQ_LINGER, (void *)(&linger),&l_size);
> assert(l_size == sizeof(linger)); cout<<"closing sender, messages
> will linger for"<<linger<<" milliseconds\n"; sleep(1);
> sender.close();
>
> If that "sleep" call is commented out, it will drop messages; with
> the sleep, it will not. The "cout" is printing -1, as expected.
>
> Is there any reason to expect this system to be dropping messages?
Are you calling zmq_term() before exiting the sending process? Note that
zmq_close() is non-blocking. Actual waiting while pending messages are
being sent happens in zmq_term().
Thus, if you simply exit() the process, pending outbound messages will
do dropped.
Martin
More information about the zeromq-dev
mailing list