Assertion failed: size > 0 && (*data == 0 || *data == 1) (xpub.cpp:66)
Description
Environment
Linux, Debian unstable
Activity
PieterP March 29, 2012 at 5:54 AM
Thanks for catching this.
Martin Hurton March 27, 2012 at 3:27 AM
This seems to be fixed by 36215656eb586a505d051dd60500e92d0f710f07. Can we resolve this?
Robert Edmonds January 6, 2012 at 1:45 AM
hm, if i understand how subscription forwarding was added on to the PUB/SUB protocol, then this patch might fix it?
https://github.com/edmonds/libzmq/commit/a27cb1dfc768404ea9d81d17ebc1c1c7c521011c
this negates the subscription forwarding optimization when a V2 subscriber is connected, but at least the publisher doesn't crash.
Robert Edmonds January 6, 2012 at 12:33 AM
i don't care about having pub/sub wire-level compatibility per se, but i would like to avoid needing to do lockstep libzmq transitions between publisher and subscriber, and i don't actually need subscription forwarding.
however if the answer is "don't connect V2 publishers to V3 subscribers and vice versa" then i can live with that, but i need a way to guarantee that this doesn't happen, even accidentally. crashing the process with an assertion failure on a protocol mismatch is not acceptable.
Martin Sustrik January 6, 2012 at 12:19 AM
This is caused by the fact that PUB/SUB wire protocol has evolved between 0MQ/2.1 and 0MQ/3.1. Namely, subscription forwarding was added.
Do you really need pub/sub wire-level compatibility between 2.1 and 3.0?
i have a test case where a subscriber binds to a socket and a publisher connects to it. this works fine if both the publisher and subscriber are both compiled and linked against libzmq 2, or both compiled and linked against libzmq 3, but fails in the case of a v2 publisher and a v3 subscriber or in the case of a v3 publisher and a v2 subscriber.
this is the v3 publisher, v2 subscriber case.
$ ./compile
+ CFLAGS='-Wall -O0 -ggdb'
+ gcc -include /usr/include/zmq.h -Wall -O0 -ggdb -o pub2 pub.c -lzmq
+ gcc -include /usr/include/zmq.h -Wall -O0 -ggdb -o sub2 sub.c -lzmq
+ gcc -include /usr/local/include/zmq.h -Wall -O0 -ggdb -o pub3 pub.c -L/usr/local/lib -lzmq
+ gcc -include /usr/local/include/zmq.h -Wall -O0 -ggdb -o sub3 sub.c -L/usr/local/lib -lzmq
edmonds@chase{0}:~/code/test/zmq-crash$ ./pub3 ipc://testcase.ipc
publisher: zeromq version 3.1.1
./pub3: connecting to socket ipc://testcase.ipc
^Z
zsh: suspended ./pub3 ipc://testcase.ipc
$ bg
[1] + continued ./pub3 ipc://testcase.ipc
$ ./sub2 ipc://testcase.ipc
subscriber: zeromq version 2.1.10
./sub2: binding to socket ipc://testcase.ipc
Assertion failed: size > 0 && (*data == 0 || *data == 1) (xpub.cpp:66)
[1] + abort ./pub3 ipc://testcase.ipc