Open
Description
Currently I see ZeroMQ/cppzmq/libzmq hanging, after I try to exit the process.
I am using libzmq 4.2.2 on Mac OS X Sierra (10.12.6) and thought that this behaviour reflects bug described here: zeromq/libzmq#1279, wich is considered to be resolved.
I post it here because I use cppzmq bindings, but I see cppzmq to cause an abort in this line:
inline bool recv (message_t *msg_, int flags_ = 0)
{
>>> int nbytes = zmq_msg_recv (&(msg_->msg), ptr, flags_);
if (nbytes >= 0)
return true;
if (zmq_errno () == EAGAIN)
return false;
throw error_t ();
}
This is my code to shutdown the context + socket(s):
int linger_value = 0;
void* native_socket = socket_;
auto result =
zmq_setsockopt
(native_socket, ZMQ_LINGER, &linger_value, sizeof(linger_value))
;
assert(0==result);
socket_.close();
context_ptr_->close();
Closing the socket here, causes the process to abort with SIGABRT. When not calling close()
on the socket the process just hangs forever.
void* native_context = *context_ptr_;
auto result = zmq_ctx_set(native_context, ZMQ_BLOCKY, 0);
I am also not able to create non-blocking context, whenever the I call zmq_ctx_set(native_context, ZMQ_BLOCKY, 0);
I receive -1
as return value.