zeromq / libzmq

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

double free or corruption (fasttop) #4593

Open uczwq opened 1 year ago

uczwq commented 1 year ago

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

Issue description

double free or corruption (fasttop) (gdb) bt

0 0x0000007f8c97c378 in raise () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libc.so.6

1 0x0000007f8c96a9c0 in abort () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libc.so.6

2 0x0000007f8c9b3fdc in ?? () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libc.so.6

3 0x0000007f8c9ba4dc in ?? () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libc.so.6

4 0x0000007f8c9bbb94 in ?? () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libc.so.6

5 0x0000007f90e2d49c in zmq::msg_t::close (this=0x7f7c002cc0) at src/msg.cpp:289

6 0x0000007f90e5b268 in zmq::encoder_base_t::encode (this=0x7f7c001e80, data=0x7f846e9798, size=) at src/encoder.hpp:83

7 0x0000007f90e4fc0c in zmq::stream_engine_base_t::out_event (this=0x7f7c0026c0) at src/stream_engine_base.cpp:357

8 0x0000007f90e240fc in zmq::io_thread_t::in_event (this=0x2ce0d550) at src/io_thread.cpp:91

9 0x0000007f90e227a4 in zmq::epoll_t::loop (this=0x2cdfe540) at src/epoll.cpp:206

10 0x0000007f90e55438 in threadroutine (arg=0x2cdfe598) at src/thread.cpp:402

11 0x0000007f8cd126d0 in start_thread () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libpthread.so.0

12 0x0000007f8ca136cc in ?? () from /opt/OK3568/host/aarch64-buildroot-linux-gnu/sysroot/lib/libc.so.6

Environment

Minimal test code / Steps to reproduce the issue

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

What's the expected result?

247gzs commented 11 months ago

https://github.com/zeromq/libzmq/issues/4594

The two issues you encountered, I am experiencing them now. Have they been resolved? Can you give me more information about how you handled them?

uczwq commented 11 months ago

4594

The two issues you encountered, I am experiencing them now. Have they been resolved? Can you give me more information about how you handled them?

Adding locks to the PUB interface:std::lock_guard lock(m_mutex);

but, Not very recommended for this solution Do you have a better solution?