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

Laughing hnwyllmm at 126.com
Fri Oct 7 11:32:29 CEST 2016

Yes, the pipe cannot receive message any more after terminated. The code as below:
in pipe.cpp:
bool zmq::pipe_t::read (msg_t *msg_)
    if (unlikely (!in_active))
        return false;
    if (unlikely (state != active && state != waiting_for_delimiter))    // the state is term_req_sent1 when receiving the second frame message while it is active when receiving the first frame message
        return false;

    if (!inpipe->read (msg_)) {
        in_active = false;
        return false;

On 10/7/2016 16:28, zmqdev<zmqdev at amitego.com>wrote:

On 07.10.2016 10:14, Laughing wrote:
>     *>>>* Is that mean that socket.disconnect does not disconnect from
>     all endpoint connected before?

see http://api.zeromq.org/4-1:zmq-disconnect

    int zmq_disconnect (void *socket, const char *endpoint);

zmq_disconnect disconnects the socket from the given endpoint *only*.

>     *>>> *It is a so bad news. I would like to use the disconnect
>     routine to discard messages in 'REQ/REP' and 'PUSH/PULL' mode.

A ZeroMQ socket holds received messages in a queue.

To empty the queue, you can

    a. receive and discard the messages until zmq_poll tells
       you there is no data

    b. destroy, then recreate & reconnect the socket

I do not know the internal details, for example whether a socket has a 
queue per connection.

The bug seems to point towards some data management problem between 
queues in the socket.

zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161007/a9cdf75b/attachment.htm>

More information about the zeromq-dev mailing list