[zeromq-dev] Subscriptions and HWMs

Staffan Gimåker staffan at spotify.com
Tue Feb 7 12:14:23 CET 2012

Hey all,

I'm taking a look at fixing https://zeromq.jira.com/browse/LIBZMQ-299,
and I'm not quite sure how to tackle it.

There are two problems concerning HWMs and (X)SUB as I see it:

1. Subscriptions are silently dropped if the SNDHWM is reached. I don't
know if that's the intended behaviour. If it is, it should probably be
more clearly documented that subscriptions might be dropped.

I know there was talk about making setsockopt(ZMQ_SUBSCRIBE, ...)
blocking [1], which would solve the "problem" of new subscriptions being
silently dropped.

2. If you have a SNDHWM set on a (X)SUB socket you're quite likely to
get an assertion at xsub.cpp:218 whenever a pipe is attached or

If loosing subscriptions upon reaching the SNDHWM is the expected
behaviour then 2 is easily fixable by just removing the assertion. If
not... then I'm not sure how to tackle it.

Bypassing the HWM for subscription messages is one option, but has its
own caveats.

Keeping track of which subscriptions has been sent is another

In any ideas of how you/we want this to work? And how to solve it?


[1]: http://osdir.com/ml/zermq-development/2011-12/msg00219.html

More information about the zeromq-dev mailing list