[zeromq-dev] assert fail into sub.cpp line 150

Martin Sustrik sustrik at 250bpm.com
Mon Dec 21 14:15:50 CET 2009

Hi Sebastien,

> I try to use filtering with setsockopt(ZMQ_SUBSCRIBE,"bla.*",5) and  
> I've got an assertion fail when a message is received on that line:
> zmq_assert (*data <= zmq_msg_size (msg_) - 1);
> It seems that you compare the first char of the message with its size ?
> Is it untested code or what should I do to avoid assertion failure?

The message to be filtered should begin with the topic string in format 
consisting of 1 byte of length + N bytes of the topic + any additional 
data. So say message with topic 'abc' and additional content 'xyz' 
should look like this:

/x03 a b c x y z

In total, message consists of 7 bytes.

The assert you are having problem with checks whether the topic size 
doesn't specify topic string longer than the whole message. It may occur 
if your message look like this for instance:

/x09 a b c


More information about the zeromq-dev mailing list