Skip to content

Problem: assertion causes abort after ZAP stop. #2476

@evoskuil

Description

@evoskuil

The following code hits the zmq_assert (ok); line [with ok false] sometimes during shutdown. So zap_pipe can be non-null and yet the zap_pipe->write can fail. The presence of the assertion implies that the write should never fail - yet there are several conditions which can produce the failure, all of which appear to be normal behavior. Please let me know if I'm missing something here. I'll make a PR to fix it if someone can confirm my assumption about the intended use of assert.

int zmq::session_base_t::write_zap_msg (msg_t *msg_)
{
    if (zap_pipe == NULL) {
        errno = ENOTCONN;
        return -1;
    }

    const bool ok = zap_pipe->write (msg_);
    zmq_assert (ok);

    if ((msg_->flags () & msg_t::more) == 0)
        zap_pipe->flush ();

    const int rc = msg_->init ();
    errno_assert (rc == 0);
    return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions