Hi Igniters,
I've got a problem with a semaphore that seems to wait for a permit even if
the node is already shut down. This behavior appears in a multi-node setup
where i try to shut down all nodes at the same time (using a poison-pill).
The code below can be used to reproduce the behavior. You will notice that
there is no call on sem1#release() - this is because in my poison-pill
scenario there seems to be no way to get a handle to sem1. And since I was
under the impression that any semaphore gets released by Ignite when the
node crashes/is shut down, I was expecting an exception on sem2#acquire().
Any ideas? Best regards,
Mario
public static void main(String[] args) {
Ignite i1 = Ignition.start(new IgniteConfiguration().setGridName("1"));
System.out.println(">>> I1 STARTED");
IgniteSemaphore sem1 = i1.semaphore("sem1", 1, true, true);
System.out.println(">>> S1 READ");
sem1.acquire();
System.out.println(">>> S1 ACQUIRED");
new Thread(() -> {
IgniteSemaphore sem2 = i1.semaphore("sem1", 1, true, true);
System.out.println(">>> S1 READ 2");
sem2.acquire();
try {
System.out.println(">>> S1 ACQUIRED 2");
} finally {
sem2.release();
}
}).start();
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(">>> I1 CLOSING");
i1.close();
System.out.println(">>> I1 CLOSED");
}
--
View this message in context:
http://apache-ignite-users.70518.x6.nabble.com/Semaphore-waiting-for-permit-even-if-node-is-shut-down-tp3232.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.