On 21/03/12 22:00, Jon Dyte wrote: > On 21/03/12 21:06, MinRK wrote: >> I have a test >> <https://github.com/zeromq/pyzmq/blob/master/zmq/tests/test_context.py#L168> >> in pyzmq, which launches a background thread in which a socket is >> created, bound and blocks on a recv that will never come, then the >> context is terminated in the main thread. The result should be a >> simple ETERM in the socket thread, but recent changes in libzmq-master >> have resulted in this test segfaulting. >> >> I discovered that this was in fact a bug in the test, because it's >> possible for ctx.term() to fire during socket *creation* instead of >> the recv. But this still shouldn't cause a problem, given the general >> notion that "sockets are not threadsafe; contexts are threadsafe". >> The fact being that the contexts are currently *not* threadsafe. >> >> The bug is new in master, and does not affect 2.1.11. >> >> isolated test case<https://gist.github.com/8835aff735f818ba3172> >> >> pretty reliably (80% of the time on my laptop) segfaults. >> >> -MinRK > I wonder whether it's these changes? > > https://github.com/zeromq/libzmq/commit/1e4c5b293af996928a2048b973978860c7de04c9#diff-9 > > Jon > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev >
I think there's a race between zmq::ctx_t::terminate and zmq::ctx_t::create_socket. If terminate gets called before create_socket has set starting to false it just does delete this. In the meantime create_socket carries merrily on. Thoughts? Jon _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
