question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Interruption in jeromq kills it

See original GitHub issue

It’s known that jeromq don’t like interruptions. But it hate it so much that an interruption at wrong time can kill it:

    @Test(timeout = 1000)
    public void testInterruptedClose() throws Throwable
    {
        ZContext ctx = new ZContext();
        Socket s = ctx.createSocket(SocketType.PULL);
        int port = Utils.findOpenPort();
        s.bind("tcp://*:" + port);
        Thread.currentThread().interrupt();
        try {
            s.close();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        // Reset the interrupt state
        Thread.interrupted();
        ctx.close();
    }

An exception is of course throws during the close. But as the close is not really finished, the ctx.close will hang, the test fails with a timeout during the zmq.Ctx.terminate().

Is such a catastrophic failure expected ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
trevorbernardcommented, Jun 9, 2020

I’ve attempted to totally wrap my head around it before but unfortunately, it’s a bit too much effort and low on my personal priority list. The cognitively complexity of the internals of libzmq/jeromq is quite large

0reactions
fbacchellacommented, Jun 14, 2020

Fixed in #836

Read more comments on GitHub >

github_iconTop Results From Across the Web

jeromq/interrupt.java at master - GitHub
public void run(). {. System.out.println("W: interrupt received, killing server..."); context.close();. try {. zmqThread.interrupt();. zmqThread.join();. }.
Read more >
Cleanly interrupt zeromq polling thread - java - Stack Overflow
I have a multithreaded application written in Java using jeromq 0.3.2. I'm working on putting it into ...
Read more >
Handling Interrupt Signals - ZeroMQ [Book] - O'Reilly
By default, these simply kill the process, meaning messages won't be flushed, files won't be closed cleanly, and so on. Example 2-10 shows...
Read more >
ZContext (JeroMQ 0.5.2 API) - javadoc.io
It provides a simple way to set the linger timeout on sockets, and configure contexts for number of I/O threads. Sets-up signal (interrupt)...
Read more >
zeromq/libzmq - Gitter
Does someone have idea about jeromq 0.5.2 java library ? I am facing issue with this library, ... Thread interrupts are specifically disallowed...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found