zeromq / libzmq

ZeroMQ core engine in C++, implements ZMTP/3.1
https://www.zeromq.org
Mozilla Public License 2.0
9.71k stars 2.35k forks source link

libzmq aborted on ypipe.hpp::probe when invoking zmq_poll #4416

Closed Rensj closed 2 years ago

Rensj commented 2 years ago

Please use this template for reporting suspected bugs or requests for help.

Issue description

When invoking function zmq_poll do poll a zmq dealer, it aborted and the program exited

Environment

Minimal test code / Steps to reproduce the issue

  1. not reproducible for now

What's the actual result? (include assertion message & call stack if applicable)

and gave the following stack back trace: (gdb) bt

0 0xb7d0c2a0 in raise () from /lib/libc.so.6

1 0xb7cf17ac in abort () from /lib/libc.so.6

2 0x0f779d24 in zmq::zmqabort (errmsg=errmsg_@entry=0xf7fb1f8 "rc") at src/err.cpp:88

3 0x0f7a9158 in zmq::ypipe_t<zmq::msgt, 256>::probe (this=0x10efaaf0, fn=0xf7a5af0 <zmq::pipe_t::is_delimiter(zmq::msg_t const&)>) at src/ypipe.hpp:172

4 0x0f7a73f4 in zmq::pipe_t::check_read (this=0x10fb46d0) at src/pipe.cpp:186

5 0x0f78f024 in zmq::fq_t::has_in (this=0x10fb4238) at src/fq.cpp:139

6 0x0f78a128 in zmq::dealer_t::xhas_in (this=) at src/dealer.cpp:113

7 0x0f7bdfdc in zmq::socket_base_t::has_in (this=0x10fb3d10) at src/socket_base.cpp:1433

8 zmq::socket_baset::getsockopt (this=0x10fb3d10, option=option@entry=15, optval=optval@entry=0x94dbc224, optvallen=optvallen_@entry=0x94dbc220) at src/socket_base.cpp:488

9 0x0f7dfff4 in zmqgetsockopt (s=, option=option@entry=15, optval=optval@entry=0x94dbc224, optvallen=optvallen@entry=0x94dbc220) at src/zmq.cpp:288

10 0x0f7e28e4 in zmqpoll (items=0x94dbc450, nitems=1, timeout=5000) at src/zmq.cpp:999

What's the expected result?

bluca commented 2 years ago

are you setting up/using the same socket from multiple threads?

Rensj commented 2 years ago

Thanks bluca for the reply. The same dealer client is used by multiple threads in this case.

bluca commented 2 years ago

As the documentation says, that is not supported and it's a bug in the application.

Rensj commented 2 years ago

Thank you bluca. Changed the code to seperate client as per the threads, and this issue was not observed any more.