[zeromq-dev] Race conditions when creating sockets from different threads?

Pavel Gushcha pavimus at gmail.com
Mon Feb 8 10:41:24 CET 2010


Sometimes my multithreaded application is crashed while creating
sockets. I wrote simple test (attached) that illustrates the problem.

Backtrace is following:

#0  0x0000003b2fa81074 in ?? () from /lib/libc.so.6
#1  0x0000003b2fa7f47a in memmove () from /lib/libc.so.6
#2  0x00007f7b15b3d063 in std::vector<zmq2::socket_base_t*,
std::allocator<zmq2::socket_base_t*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<zmq2::socket_base_t**,
std::vector<zmq2::socket_base_t*, std::allocator<zmq2::socket_base_t*>
> >, zmq2::socket_base_t* const&) () from /usr/lib/libzmq.so.0
#3  0x00007f7b15b3cec3 in zmq2::app_thread_t::create_socket(int) ()
from /usr/lib/libzmq.so.0
#4  0x00007f7b15b3f793 in zmq2::dispatcher_t::create_socket(int) ()
from /usr/lib/libzmq.so.0
#5  0x00000000004009fa in thread_run (ctx=0x602010) at test3.c:16
#6  0x0000003b30606894 in start_thread () from /lib/libpthread.so.0
#7  0x0000003b2fad0f9d in clone () from /lib/libc.so.6
#8  0x0000000000000000 in ?? ()

Problem is not depending from type of sockets (i tried ZMQ_P2P, ZMQ_PUB).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test3.c
Type: text/x-c
Size: 639 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100208/9dbba279/attachment.bin>


More information about the zeromq-dev mailing list