Vladimir, 
thanks for your efforts. Do you see any way around this problem? It feels
like I'm running out of options (see below).

I'm not sure this is related, but I tried to replace the cache lock with a
semaphore but things get even weirder. 

To reproduce 
  (1) start a new node (see code below) and wait for the "acquired" message
  (2) start another node and wait until it joins the cluster
  (3) kill the node created in (1) - the node created in (2) will take over
and print "acquired"
  (4) start yet another node and wait until it joins the cluster
  (5) kill the node created in (3) - when this node is trying to acquire the
semaphore the following ex is     thrown:

SEVERE: <ignite-atomics-sys-cache> Failed to compare and set:
o.a.i.i.processors.datastructures.GridCacheSemaphoreImpl$Sync$2@b7b3649
class org.apache.ignite.IgniteCheckedException: Failed to find semaphore
with given name: sem1
        at
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl$Sync$2.call(GridCacheSemaphoreImpl.java:333)
        at
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl$Sync$2.call(GridCacheSemaphoreImpl.java:323)
        at
org.apache.ignite.internal.processors.cache.GridCacheUtils$24.call(GridCacheUtils.java:1776)
        at
org.apache.ignite.internal.processors.cache.GridCacheUtils.outTx(GridCacheUtils.java:982)
        at
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl$Sync.releaseFailedNode(GridCacheSemaphoreImpl.java:322)
        at
org.apache.ignite.internal.processors.datastructures.GridCacheSemaphoreImpl.onNodeRemoved(GridCacheSemaphoreImpl.java:504)
        at
org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor$1$1.call(DataStructuresProcessor.java:191)
        at
org.apache.ignite.internal.util.IgniteUtils.wrapThreadLoader(IgniteUtils.java:6397)
        at
org.apache.ignite.internal.processors.closure.GridClosureProcessor$2.body(GridClosureProcessor.java:929)
        at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

There seems to be no way to retry acquiring the semaphore - Ignite just
hangs ...
Note that, in a more complex test scenario I can reproduce this behavior
with just two nodes.

Regards, 
Mario


public static void main(String[] args) {
        try {
            Ignite ignite = Ignition.start(new
IgniteConfiguration().setGridName("1"));
            System.out.println("started");

            IgniteSemaphore sem = ignite.semaphore("sem1", 1, true, true);
            System.out.println("created");

            sem.acquire();
            System.out.println("acquired");
        } catch (Exception e) {
            System.out.println("oh no");
        }
    }



--
View this message in context: 
http://apache-ignite-users.70518.x6.nabble.com/Semaphore-blocking-on-tryAcquire-while-holding-a-cache-lock-tp3031p3061.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Reply via email to