[zeromq-dev] Accessing message after close?

Pieter Hintjens ph at imatix.com
Sat Apr 30 10:00:07 CEST 2011


Martin,

While testing issue 199 I got this crash in xrep:

Program terminated with signal 6, Aborted.
#0  0x00007effad821ba5 in raise (sig=<value optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007effad8256b0 in abort () at abort.c:92
#2  0x00007effae4ab329 in zmq::xrep_t::xrecv (this=0x1e028f0,
msg_=0x7fff97959f70, flags_=0) at xrep.cpp:248
#3  0x00007effae4a356c in zmq::socket_base_t::recv (this=0x1e028f0,
msg_=0x7fff97959f70, flags_=0) at socket_base.cpp:519
#4  0x00007effae4af178 in zmq_recv (s_=0x1e028f0, msg_=0x7fff97959f70,
flags_=0) at zmq.cpp:384
...

Which is here:

    //  Deallocate old content of the message.
    int rc = msg_->close ();
    errno_assert (rc == 0);

    //  If we are in the middle of reading a message, just grab next part of it.
    if (more_in) {
        zmq_assert (inpipes [current_in].active);
        bool fetched = inpipes [current_in].reader->read (msg_);
        zmq_assert (fetched);
        more_in = msg_->flags () & msg_t::more;
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Question: is it normal that the code does msg_->flags() after doing
msg_->close()?  If so, any other plausible cause for this crash?

-Pieter



More information about the zeromq-dev mailing list