[zeromq-dev] HWM ignored on inproc connection

Martin Sustrik sustrik at 250bpm.com
Mon Jan 3 09:09:40 CET 2011

Hi Douglas,

> It looks like the problem is in how the underlying pipes are created
> for inproc connections.  The pipes aren't created until the
> zmq_connect call, and it uses the options from the connecting socket
> for both pipes.  If you change the test case so that it calls
> setsockopt on the "in" socket (even though it's a PULL, and should
> therefore ignore its HWM), it blocks correctly.
> I think zmq_connect should use the binding socket's options for the
> inbound pipe.

That's an interesting problem consisting of several two smaller problems.

1. There should be inbound and outbound HWM to be set separately 
(ZMQ_SNDHWM, ZMQ_RCVHWM). This can possibly be done without breaking 
backward compatibility. Existing ZMQ_HWM would just be reimplemented as 
setting both ZMQ_SNDHWM and ZMQ_RCVHWM.

2. In case of tcp:// there's a buffer on each side of the connection, 
however, in case of inproc:// there's a single buffer shared by the 
peers. The question is how to set the HWM in this case.

For example, socketpair has the same problem and solves it by using only 
SO_SNDBUF value while ignoring SO_RCVBUF value.

In case of 0MQ we can opt either for symmetric or asymmetric design. 
Symmetric design would use the sum of ZMQ_SNDBUF+ZMQ_RCVBUF of the peers 
to compute the max HWM for the pipe.

Asymmetric option would mimic socketpair's solution of ignoring the 
value of one peer. In such case there are 4 options:

a. ignore sender's HWM
b. ignore receiver's HWM
c. ignore connecter's HWM
d. ignore binder's HWM


More information about the zeromq-dev mailing list