[zeromq-dev] Inproc endpoint and zmq_term.

Victor Vlasenko vlasenko at sysgears.com
Mon Jan 24 14:20:47 CET 2011


Hi All,

Blocking behavior of zmq_term is very good for correctly flushing all 
the messages on termination for network connections. However it seems 
that this doesn't work so good currently for inproc connections.

For inproc connections with blocking socket.recv() zmq_term might 
generate TERM on our blocking recv earlier than messages will be flushed 
to the socket. The issue is with order of operations, currently there is 
no specific order of when messages will be flushed and when blocking 
operation exit with TERM. If however zeromq first tried to flush all the 
messages to all sockets and only after that generated TERM on all 
blocking socket.recv() operations this way messages weren't loosed for 
inprocess connections.

Given that inproc sockets have shared buffer, the correct behavior would 
be to not generate TERM on recv() operations until this shared buffer is 
empty.

The code that illustrates issue is provided here:
http://pastebin.com/9x0txGzS
Total message handled, that output by the code is not always 100, as 
expected, but at times 99 or 98, e.g. some messages are lost.

OS: Linux x64 2.6.32
ZeroMQ version: 2.1.0

Victor



More information about the zeromq-dev mailing list