[zeromq-dev] BUG: SUB socket + multi-part message + disconnect + recv = Assertion failed at src/fq.cpp:117

af alotsof at gmx.net
Thu Oct 6 19:52:49 CEST 2016



* ZEROMQ VERSION

    - 4.1.4
    - 4.1.5


* SYSTEM

    - RHEL 6.8 on x86_64
    - Ubuntu 16.04 on x86_64


* TEST CASE (see attachment)

    create PUB socket
    bind endpoint

    create SUB socket
    subscribe all
    connect endpoint

    wait a little for connection to take place

    send message with two frames through PUB

    check SUB has data with zmq_poll

    unsubscribe SUB from all
    disconnect SUB from endpoint

    receive frame 1 from SUB
    receive frame 2 from SUB


* EXPECTED BEHAVIOR

    get message with two frames


* ACTUAL BEHAVIOR

    trying to retrieve the second frame of the message with zmq_msg_recv
    triggers the assertion in src/fq.cpp:117.

    $ ./p1
    [26499] bound PUB to tcp://*:23456
    [26499] subscribed SUB to all
    [26499] connected SUB to tcp://localhost:23456
    [26499] sent message through PUB
    [26499] polled SUB socket: there is data
    [26499] unsubscribed SUB from all
    [26499] disconnected SUB from tcp://localhost:23456
    [26499] receiving from sub...
    [26499] reading frame 1 from sub...
    [26499] received frame 1 through sub: data in first frame
    [26499] reading frame 2 from sub...
    Assertion failed: !more (src/fq.cpp:117)
    Aborted (core dumped)


* NOTE

    everything works fine without the zmq_disconnect


* OTHER CASES WITH SAME ASSERTION

    http://lists.zeromq.org/pipermail/zeromq-dev/2016-September/030839.html
    https://github.com/zeromq/libzmq/issues/1143


* WHY WOULD SOMEONE DISCONNECT A SUB SOCKET WITH DATA?

    Nodes can be added or removed. Some messages are commands to connect or
    disconnect those nodes.


* ADDITIONAL QUESTION

    by the time I fetch the message from the SUB socket, I already
expressed my
    disinterest with ZMQ_UNSUBSCRIBE.

    Should the SUB socket give me a message that doesn't match the currently
    defined filters?

    The specification at

        https://rfc.zeromq.org/spec:29/PUBSUB/

    is not clear to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zmq-sub-disconnect-recv-bug.tar.gz
Type: application/gzip
Size: 2410 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161006/c0ce8374/attachment.gz>


More information about the zeromq-dev mailing list