[zeromq-dev] Intermittent crash in zmq connect

Jasper Jaspers jaspers01995 at gmail.com
Fri Jul 29 17:28:02 CEST 2022


Seeing an intermittent crash on startup of our application – it happens
about 1 out of every 50 times we start the application.  The application
has a SUB socket that connects to multiple PUBS.  It’s crashing while
trying to connect to one of the PUBs that just came online.  From the core
file I could see that two threads are using the same socket – Thread
1(where crash occurred) is performing the zmq connect while Thread 33 is
doing a zmq receive.  From the zeromq docs, having multiple threads
accessing the same socket is no good.  Based on the following back trace
does this look like the multi-threaded issue they warn against?

Thread 1 (Thread 0x7fc646bfa700 (LWP 396484)):

#0  zmq::trie_t::apply_helper (this=<optimized out>,
buff_=buff_ at entry=0x7fc646bf8c10,
buffsize_=buffsize_ at entry=1, maxbuffsize_=maxbuffsize_ at entry=256,
func_=func_ at entry=0x7fc6e94490a0 <zmq::xsub_t::send_subscription(unsigned
char*, unsigned long, void*)>, arg_=arg_ at entry=0x7fc63005bde0) at
src/trie.cpp:307

#1  0x00007fc6e943ffbb in zmq::trie_t::apply_helper
(this=this at entry=0x7fc6b025f628,
buff_=buff_ at entry=0x7fc646bf8c10, buffsize_=buffsize_ at entry=0,
maxbuffsize_=256, maxbuffsize_ at entry=0, func_=func_ at entry=0x7fc6e94490a0
<zmq::xsub_t::send_subscription(unsigned char*, unsigned long, void*)>,
arg_=arg_ at entry=0x7fc63005bde0) at src/trie.cpp:315

#2  0x00007fc6e9440002 in zmq::trie_t::apply (this=this at entry=0x7fc6b025f628,
func_=func_ at entry=0x7fc6e94490a0 <zmq::xsub_t::send_subscription(unsigned
char*, unsigned long, void*)>, arg_=arg_ at entry=0x7fc63005bde0) at
src/trie.cpp:276

#3  0x00007fc6e9448dc7 in zmq::xsub_t::xattach_pipe (this=0x7fc6b025eed0,
pipe_=0x7fc63005bde0, subscribe_to_all_=<optimized out>,
locally_initiated_=<optimized out>) at src/xsub.cpp:73

#4  0x00007fc6e942d238 in zmq::socket_base_t::attach_pipe
(this=this at entry=0x7fc6b025eed0,
pipe_=0x7fc63005bde0, subscribe_to_all_=subscribe_to_all_ at entry=false,
locally_initiated_=locally_initiated_ at entry=true) at src/socket_base.cpp:417

#5  0x00007fc6e942ec89 in zmq::socket_base_t::connect_internal
(this=0x7fc6b025eed0, endpoint_uri_=0x7fc6c8001200 "tcp://192.168.1.15:40453
<http://10.0.0.15:40453/>") at src/socket_base.cpp:1104

#6  0x00007fc6e942f4f0 in zmq::socket_base_t::connect (this=0x7fc6b025eed0,
endpoint_uri_=0x7fc6c8001200 "tcp://192.168.1.15:40453
<http://10.0.0.15:40453/>") at src/socket_base.cpp:773



Thread 33 (Thread 0x7fc6667f9700 (LWP 396362)):

#0  0x00007fc6e7891ac1 in poll () from /usr/share/ace/lib/libc.so.6

#1  0x00007fc6e942861e in poll (__timeout=250, __nfds=1,
__fds=0x7fc6667f8520) at /usr/include/bits/poll2.h:46

#2  zmq::signaler_t::wait (this=this at entry=0x7fc6b020dd18, timeout_=250) at
src/signaler.cpp:246

#3  0x00007fc6e9404cc4 in zmq::mailbox_t::recv (this=0x7fc6b020dcb0,
cmd_=0x7fc6667f8580, timeout_=<optimized out>) at src/mailbox.cpp:81

#4  0x00007fc6e942a1ea in zmq::socket_base_t::process_commands
(this=this at entry=0x7fc6b025eed0, timeout_=200, throttle_=throttle_ at entry=false)
at src/socket_base.cpp:1501

#5  0x00007fc6e942b0fe in zmq::socket_base_t::recv (this=0x7fc6b025eed0,
msg_=msg_ at entry=0x7fc6667f87b0, flags_=<optimized out>) at
src/socket_base.cpp:1386

#6  0x00007fc6e9449f59 in s_recvmsg (s_=<optimized out>,
msg_=0x7fc6667f87b0, flags_=<optimized out>) at src/zmq.cpp:493


Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20220729/f71c3a8f/attachment.htm>


More information about the zeromq-dev mailing list