You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Jakub StrolenĂ½ (JIRA)" <ji...@apache.org> on 2016/03/04 14:42:40 UTC
[jira] [Updated] (CURATOR-307) InterProcessReadWriteLock can throw
IndexOutOfBoundsException when connection is lost
[ https://issues.apache.org/jira/browse/CURATOR-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jakub StrolenĂ½ updated CURATOR-307:
-----------------------------------
Description:
We are using recipe InterProcessMutex as lock for our cluster environment.
We found that it is possible that acquiring and/or releasing of lock can fail when connection to ZooKeeper is lost or changed.
If you have have following sample code:
InterProcessMutex.acquire();
doSomething();
InterProcessMutex.release();
You can get following exception in release() method, when connection is lost after lock is acquired.
Stack trace:
{{java.lang.IllegalMonitorStateException: You do not own the lock: /clusters/Production/something/lock
at org.apache.curator.framework.recipes.locks.InterProcessMutex.release(InterProcessMutex.java:128)}}
and following stack trace when lock directory is empty (because emphemeral nodes are deleted, because of connection was lost)
{{java.lang.IndexOutOfBoundsException: Index: 2147483647, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock.readLockPredicate(InterProcessReadWriteLock.java:190)
at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock.access$0(InterProcessReadWriteLock.java:163)
at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock$2.getsTheLock(InterProcessReadWriteLock.java:137)
at org.apache.curator.framework.recipes.locks.LockInternals.internalLockLoop(LockInternals.java:287)
at org.apache.curator.framework.recipes.locks.LockInternals.attemptLock(LockInternals.java:226)
at org.apache.curator.framework.recipes.locks.InterProcessMutex.internalLock(InterProcessMutex.java:221)
at org.apache.curator.framework.recipes.locks.InterProcessMutex.acquire(InterProcessMutex.java:77)}}
These operations should fail more gracefully, maybe with dedicated exception, when connection is lost or changed.
was:
We are using recipe InterProcessMutex as lock for our cluster environment.
We found that it is possible that acquiring and/or releasing of lock can fail when connection to ZooKeeper is lost or changed.
If you have have following sample code:
InterProcessMutex.acquire();
doSomething();
InterProcessMutex.release();
You can get following exception in release() method, when connection is lost after lock is acquired.
Stack trace:
{{
java.lang.IllegalMonitorStateException: You do not own the lock: /clusters/Production/something/lock
at org.apache.curator.framework.recipes.locks.InterProcessMutex.release(InterProcessMutex.java:128)
}}
and following stack trace when lock directory is empty (because emphemeral nodes are deleted, because of connection was lost)
{{
java.lang.IndexOutOfBoundsException: Index: 2147483647, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock.readLockPredicate(InterProcessReadWriteLock.java:190)
at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock.access$0(InterProcessReadWriteLock.java:163)
at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock$2.getsTheLock(InterProcessReadWriteLock.java:137)
at org.apache.curator.framework.recipes.locks.LockInternals.internalLockLoop(LockInternals.java:287)
at org.apache.curator.framework.recipes.locks.LockInternals.attemptLock(LockInternals.java:226)
at org.apache.curator.framework.recipes.locks.InterProcessMutex.internalLock(InterProcessMutex.java:221)
at org.apache.curator.framework.recipes.locks.InterProcessMutex.acquire(InterProcessMutex.java:77)
}}
These operations should fail more gracefully, maybe with dedicated exception, when connection is lost or changed.
> InterProcessReadWriteLock can throw IndexOutOfBoundsException when connection is lost
> -------------------------------------------------------------------------------------
>
> Key: CURATOR-307
> URL: https://issues.apache.org/jira/browse/CURATOR-307
> Project: Apache Curator
> Issue Type: Bug
> Components: Recipes
> Affects Versions: 2.4.0
> Reporter: Jakub StrolenĂ½
> Priority: Critical
>
> We are using recipe InterProcessMutex as lock for our cluster environment.
> We found that it is possible that acquiring and/or releasing of lock can fail when connection to ZooKeeper is lost or changed.
> If you have have following sample code:
> InterProcessMutex.acquire();
> doSomething();
> InterProcessMutex.release();
> You can get following exception in release() method, when connection is lost after lock is acquired.
> Stack trace:
> {{java.lang.IllegalMonitorStateException: You do not own the lock: /clusters/Production/something/lock
> at org.apache.curator.framework.recipes.locks.InterProcessMutex.release(InterProcessMutex.java:128)}}
> and following stack trace when lock directory is empty (because emphemeral nodes are deleted, because of connection was lost)
> {{java.lang.IndexOutOfBoundsException: Index: 2147483647, Size: 0
> at java.util.ArrayList.rangeCheck(ArrayList.java:653)
> at java.util.ArrayList.get(ArrayList.java:429)
> at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock.readLockPredicate(InterProcessReadWriteLock.java:190)
> at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock.access$0(InterProcessReadWriteLock.java:163)
> at org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock$2.getsTheLock(InterProcessReadWriteLock.java:137)
> at org.apache.curator.framework.recipes.locks.LockInternals.internalLockLoop(LockInternals.java:287)
> at org.apache.curator.framework.recipes.locks.LockInternals.attemptLock(LockInternals.java:226)
> at org.apache.curator.framework.recipes.locks.InterProcessMutex.internalLock(InterProcessMutex.java:221)
> at org.apache.curator.framework.recipes.locks.InterProcessMutex.acquire(InterProcessMutex.java:77)}}
> These operations should fail more gracefully, maybe with dedicated exception, when connection is lost or changed.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)