[zeromq-dev] Assert in XSUB (send_subscription)

Martin Sustrik sustrik at 250bpm.com
Mon Dec 19 16:26:50 CET 2011


Hi Daniel,

> With the change in 3.x of having a default HWM of 1000, we ran into
> assertion error on XSUB sockets.
>
> send_subscription will assert if the socket has reached SNDHWM, where
> it before would eventually run out of memory if a corresponding PUB
> peer never showed up.
>
> In any case, an assertion is pretty harsh when reaching exceptional state.
>
> I don't have a good idea what behavior an XSUB *should* exhibit in
> that case, though, I think perhaps it'd make more sense to block (like
> PUSH)?

Blocking setsockopt(ZMQ_SUBSCRIBE) sounds pretty strange, but it's in a 
way the only sound option.

The other option I can think of is returning an error (ENOMEM?) from 
setsockopt() in such situation.

Finally, it's possible to set the HWM to infinite, which would lead to 
OOM crash in case the socket is severely overloaded by subscription.

Martin



More information about the zeromq-dev mailing list