Description
Hello,
Version: 4.0.4
RHEL: 6.1
Scenario:
- try to create second monitor for same connection (this is invalid use and happened by wrong user code, fixed)
- monitor socket bind is failed and rc = -1.
- stop_monitor called
- existing subscription for ZMQ_EVENT_MONITOR_STOPPED
- hanging user code at in zmq::signaler_t::wait (this=..., timeout_=-1) at signaler.cpp:173
Analysis:
- wrong usage of zero mq is fixed to create single monitor. It is not a point.
- int zmq::socket_base_t::monitor (const char *addr_, int events_) calls stop_monitor if 1) zmq_setsockopt failed and 2) zmq_bind is failed.
- I think this is wrong to call stop_monitor if socket is not bound since in case ZMQ_EVENT_MONITOR_STOPPED subscription exists it will call zmq_sendmsg on monitor_socket which is not bound to address or failed to set socket option.
At least I could not find another answer why user thread hangs. I apologize if idea is wrong.
Stack:
Thread 1 (Thread 0x7f80d2e23740 (LWP 15523)):
#0 0x00007f80c82e5053 in poll () from /lib64/libc.so.6
#1 0x00007f80cb341056 in zmq::signaler_t::wait (this=0x1f6816360, timeout_=-1) at signaler.cpp:173
#2 0x00007f80cb33217e in zmq::mailbox_t::recv (this=0x1f6816300, cmd_=0x7fff786b5e20, timeout_=-1) at mailbox.cpp:72
#3 0x00007f80cb341954 in zmq::socket_base_t::process_commands (this=0x1f6816000, timeout_=, throttle_=false) at socket_base.cpp:872
#4 0x00007f80cb341d80 in zmq::socket_base_t::send (this=0x1f6816000, msg_=0x7fff786b5ed0, flags_=) at socket_base.cpp:724
#5 0x00007f80cb35575a in s_sendmsg (s_=0x1f6816000, msg_=0x7fff786b5ed0, flags_=2) at zmq.cpp:350
#6 0x00007f80cb3412d8 in zmq::socket_base_t::monitor_event (this=0x8013700, event_=, addr_="") at socket_base.cpp:1249
#7 0x00007f80cb34366a in zmq::socket_base_t::stop_monitor (this=0x8013700) at socket_base.cpp:1265
#8 0x00007f80cb343886 in zmq::socket_base_t::monitor (this=0x8013700, addr_=0x1f537b0a8 "inproc://monitor.sock.KROMBERG_RTA2ZMQ_REQ0", events_=2047) at socket_base.cpp:1133
Aleksei.