Indeed, this looks like two threads trying to work with the same socket. Can we reproduce this in C?
On Sat, Nov 8, 2014 at 1:41 PM, Peter Kleiweg <[email protected]> wrote: > > Does anyone know of a solution for this? > How do I close a monitor? > > > Peter Kleiweg schreef op de 31e dag van de wijnmaand van het jaar 2014: > >> >> Situation: >> >> 1. create a context >> 2. create socket >> 3. put monitor on socket with zmq_socket_monitor() >> 4. socket: connect to address >> 5. socket: remove connection >> 6. terminate the context >> >> Repeat this often enough, and either the program will hang at >> step 6, or crash with an error at step 6. The errors vary. These >> are the ones I have seen: >> >> Bad file descriptor (signaler.cpp:269) >> Assertion failed: pfd.revents & POLLIN (signaler.cpp:226) >> Invalid argument (mutex.hpp:99) >> Resource temporarily unavailable (signaler.cpp:269) >> Segmentation fault >> >> The problem disappears if you have a thread (or goroutine) >> actually reading the messages from the monitor, and if you >> insert a sleep (0.1 seconds) between steps 5 and 6 as well. >> >> Problem observed with ZeroMQ 3.2, 4.0 and 4.1, on linux/amd64, >> using the Go interfaces zmq3 and zmq4. >> >> Please see details and code examples here: >> >> https://github.com/pebbe/zmq4/issues/28 >> >> My guess of what is going on is this: The monitor is running in >> its own thread, while zmq_ctx_term() tries to close the >> monitoring socket in the main thread. Thus, the socket would be >> used in two threads at once, and since sockets aren't >> thread-safe, a crash follows. >> >> >> > > > > -- > Peter Kleiweg > http://pkleiweg.home.xs4all.nl/ > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
