[zeromq-dev] Deadlock with ctx_term
Alexander Kampmann
s9alkamp at stud.uni-saarland.de
Fri Nov 6 12:12:33 CET 2015
hey,
I am using ZeroMQ in Java with PUSH and PULL sockets.
Basically everything is working as excepted, however, sometimes the call
to close() on the context deadlocks (jzmq makes that a term() call on
the context). The deadlock occurs with jzmq and jeromq, and it would be
rather strange if two implementations have the same bug, so I suspect
that this might be an error on my part.
Do you have any advice on how to debug this? Or maybe some
frequently-made-error which can cause this?
The deadlock does not happen always, but too often (= I have a test case
which deadlocks approximately every fifth execution). As I said, the
deadlock happens for both, jzmq and jeromq. When I attach my debugger to
jeromq, I can see that the reaper-thread terminated, but the sockets
list in the context still contains a PUSH socket. destroy() has not been
called on the socket.
I think that close() is called, because I am using a try-with-resource
when I create the socket. If it indeed has not been called, this is a
bug in the java-8-compiler. I tried to confirm that close has been
called, but if I set a breakpoint or add a printout in the close()
method, the deadlock would not occur. It did reappear after I removed
the breakpoint/printout.
Best regards,
Alex
More information about the zeromq-dev
mailing list