[zeromq-dev] zmq_abort() called
Mark Botner
mbotner at gmail.com
Tue Jul 28 15:17:40 CEST 2020
Hello 0MQ gurus,
I've been using 0MQ for several years now and continue to be impressed with
this amazing communications library!
Recently I had an application abort when what I think was a connect() call
accidentally using the same routing ID via the
setsockopt(ZMQ_CONNECT_ROUTING_ID). I think the calling sequence is
something like this:
setsockopt() // sets ZMQ_CONNECTION_ROUTING_ID
connect()
socket was used for some period of time
disconnect()
very quickly after the disconnect
setsockopt() // same routing id as above
connect() -> zmq_abort()
The partial back trace is:
#2 0x0000000000687609 in zmq::zmq_abort (errmsg_=errmsg_ at entry=0x9f483d
"!has_out_pipe (routing_id)") at src/err.
cpp:88
#3 0x00000000006c3ba9 in zmq::router_t::identify_peer
(this=this at entry=0x3824700,
pipe_=0x3d7c700, locally_initia
ted_=locally_initiated_ at entry=true) at src/router.cpp:461
#4 0x00000000006c4238 in zmq::router_t::xattach_pipe (this=0x3824700,
pipe_=0x3d7c700, subscribe_to_all_=<optimized out>,
locally_initiated_=<optimized out>) at src/router.cpp:93
#5 0x00000000006975e1 in zmq::socket_base_t::attach_pipe
(this=this at entry=0x3824700,
pipe_=0x3d7c700, subscribe_to_all_=subscribe_to_all_ at entry=false,
locally_initiated_=locally_initiated_ at entry=true) at src/socket_base.cpp:388
#6 0x0000000000697e87 in zmq::socket_base_t::connect (this=0x3824700,
endpoint_uri_=0x39725a0 "tcp://172.17.0.8:8000") at src/socket_base.cpp:973
I think the disconnect() must be asynchronous and the routing ID was still
in use at the time of the second connect() and thus the zmq_abort(). Does
this make sense?
The only work around I can think of is to sleep for a short period of time
(10 seconds) before the 2nd connect() if the ROUTING id is being re-used in
order to allow ZeroMQ enough time to remove the ROUTING ID. I do have
LINGER set to zero on the socket which is of ROUTER type.
Is there a better way to prevent this problem or work around what I think
is a deferred deletion of the ROUTING_ID?
Thanks!
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20200728/731d519d/attachment.htm>
More information about the zeromq-dev
mailing list