[zeromq-dev] Race condition in cppzmq zmq::socket_t::close() / cppzmq tag?

Eric Pederson ericacm at gmail.com
Wed Dec 14 08:24:46 CET 2016

I ran into a race condition in zmq::socket_t::close() in cppzmq:

*inline void *close() ZMQ_NOTHROW
    *if*(ptr == NULL)

*// already closed        **return *;

*// Someone can sneak in here and close the socket*
    *int *rc = zmq_close (ptr);
    ZMQ_ASSERT (rc == 0);
    ptr = 0 ;

I worked around it using compare-and-swap to atomically check if it's
already closed. Does that kind of fix sound reasonable for

Also I wanted to follow up on my previous question about tagging cppzmq.  I
think that conversation got lost in the list shutdown that happened
recently.  Does it make sense to regularly tag the cppzmq repo with the
corresponding ZeroMQ version?


-- Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161214/f89e312f/attachment.htm>

More information about the zeromq-dev mailing list