see http://lists.zeromq.org/pipermail/zeromq-dev/2013-July/022199.html for
prosa.
Basically I suspect, that a sequence of:
1. sending a large message
2. close the sending socket
Does not respect the linger value of the socket, resulting in a lost message.
If the testcase https://zeromq.jira.com/secure/attachment/14602/zmq_test.cpp works for you it should fail with the assertion on line 140.
testcase
Hi!
LINGER is an option used on the OS level sockets.
Sending is an asynchronous process.
Your test simply destroys the socket and the context before the message has been sent to the underlying socket.
This is clearly shown by the sleeps in your code.
I don't think this is a bug in libzmq.
edit: typos
Hi Guido,
the bug is referring to the ZMQ_LINGER option as documented in zmq_setsockopt(3).
The 'ZMQ_LINGER' option shall set the linger period for the specified 'socket'.
The linger period determines how long pending messages which have yet to be
sent to a peer shall linger in memory after a socket is closed with
linkzmq:zmq_close[3], and further affects the termination of the socket's
context with linkzmq:zmq_term[3].
See https://github.com/zeromq/libzmq/blob/455739f94258c021bfdc001f3aa315374058e912/doc/zmq_setsockopt.txt for full text and required behaviour.
I think the OS level SO_LINGER is an an implementation detail. Or am I misinterpreting zmq_setsockopt.txt?
I also think this is a bug. Here is another test case:
I stand corrected.
Further experiments and a search for linger in the libzmq sources
seem to point at pipe.cpp line 393.
If there are "unfinished" messages, they are removed.
The scenario I envision atm is:
1. zmq kernel received large message via outbound pipe
2. message processing starts
3. first chunks are sent to the socket (os level buffers)
4. message not done and marked as such
5. terminate arrives
6. unfinshed state detected, message killed from pipe, socket closed
7. receiver gets a close of peer and drops incomplete message
I really hope someone with a deeper understanding can comment on that.
Thanks in advance.