Hi,
In line with a deadlock reported earlier
<https://issues.apache.org/jira/browse/IGNITE-6380#> , please see below
another deadlock scenario, this time with renetrant locks:
private void start2() {
Ignite ignite = null;
try{
ignite = Ignition.start("ignite-deadlock.xml");
IgniteCache<Object, Object> cache1 =
ignite.getOrCreateCache(getConfig("cache1"));
IgniteCache<Object, Object> cache2 =
ignite.getOrCreateCache(getConfig("cache2"));
// ignite.l
CountDownLatch latch1 = new CountDownLatch(1);
CountDownLatch latch2 = new CountDownLatch(1);
Thread t = new Thread(() -> {
Lock lock = cache2.lock("fake");
try
{ lock.lock(); System.out.println("Locked"); latch1.countDown();
latch2.await(); cache1.clear(); }
catch(InterruptedException e)
{ Thread.currentThread().interrupt(); e.printStackTrace(); throw new
RuntimeException(e); }
catch(Exception e)
{ e.printStackTrace(); throw new RuntimeException(e); }
finally
{ lock.unlock(); }
});
t.start();
latch1.await();
ignite.reentrantLock("blah", true, true, true);
latch2.countDown();
t.join();
System.out.println("No deadlock");
}catch(InterruptedException e)
{ Thread.currentThread().interrupt(); e.printStackTrace(); throw new
RuntimeException(e); }
finally
{ if(ignite!=null) ignite.close(); }
}
If you could please triage and accept this as a defect.
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/