[
https://issues.apache.org/jira/browse/IGNITE-2008?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15037486#comment-15037486
]
Semen Boikov commented on IGNITE-2008:
--------------------------------------
Roy,
As a workaround you can use PESSIMISTIC/REPEATABLE_READ transactions for
disributed locks (in PESSIMISTIC mode a lock is acquired for all cache
operations):
{code}
IgniteCache cache = ignite.cache("cache");
try (Transaction tx = ignite.transactions().txStart(PESSIMISTIC,
REPEATABLE_READ)) {
cache.get(key); // Lock is acquired.
tx.commit(); // Lock is released.
}
{code}
> Abandoned locks are not released when nodes leave the grid
> ----------------------------------------------------------
>
> Key: IGNITE-2008
> URL: https://issues.apache.org/jira/browse/IGNITE-2008
> Project: Ignite
> Issue Type: Bug
> Affects Versions: ignite-1.4
> Environment: Ubuntu 12.04, Ignite 1.4, Java 1.8.0_40-b26 (HotSpot
> 64-Bit)
> Reporter: Noam Liran
> Assignee: Semen Boikov
> Fix For: 1.6
>
>
> Hi,
> We're starting to use Ignite in one of our environments and we've encountered
> some strange behaviour in one of our test cases.
> # Start two nodes at the same time.
> # Each nodes should initialize a cache with the following parameters:
> ## Cache mode: REPLICATED / PARTITIONED
> ## Atomicity mode: TRANSACTIONAL
> # Both nodes run the following code:
> {code}
> System.out.println("Sleeping before..");
> Thread.sleep(5000);
> List<Lock> locks = new ArrayList<>();
> System.out.println("Acquiring...");
> for (int lockId = 0; lockId < 4; lockId++) {
> String lockName = "LOCK_" + lockId;
> Lock lock = cache.lock(lockName);
> locks.add(lock);
> lock.lock();
> }
> System.out.println("Acquired!");
> Thread.sleep(20000);
> System.out.println("Done");
> {code}
> # Node 1 acquires all the relevant locks and waits a while.
> # Node 2 tries to acquire the locks and is blocked.
> # Node 1 eventually quits while holding the locks.
> # Node 2 never gains control of the locks even though they're abandoned.
> When we try the same with a looped tryLock everything seems to work.
> Our Ignite configuration is pretty straightforward:
> # Regular TCP discovery
> # No checkpointing SPI
> # No collision SPI
> # Always failover SPI
> # CONTINUOUS deployment mode
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)