Closed
Description
Looks like there is some issue in ZLoop
: as long as I interrupt the thread for loop, the ZContext
cannot be destroyed. It is stuck on waiting for in the Ctx
:
// Wait till reaper thread closes all the sockets.
Command cmd = termMailbox.recv(WAIT_FOREVER);
Sometimes it can pass though, but in most cases it looks like in dead lock situation.
Here is some test-case to reproduce:
@Test
public void test() throws InterruptedException {
ExecutorService executorService = Executors.newFixedThreadPool(1);
ZContext ctx = new ZContext();
ZMQ.Socket socket = ctx.createSocket(SocketType.PULL);
socket.bind("ipc://test");
ZLoop zLoop = new ZLoop(ctx);
ZMQ.PollItem pollItem = new ZMQ.PollItem(socket, ZMQ.Poller.POLLIN);
zLoop.addPoller(pollItem, (loop, item, arg) -> 0, null);
Future<Integer> future = executorService.submit(zLoop::start);
Thread.sleep(1000);
future.cancel(true);
socket.close();
ctx.close();
executorService.shutdownNow();
}
JeroMQ version is 0.5.2
.
I won't mind though if I use this API wrong way: I'm just in the beginning of ZeroMQ journey.
Thanks in advance for any hints!
Metadata
Assignees
Labels
No labels