curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jordan Zimmerman (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CURATOR-307) InterProcessReadWriteLock can throw IndexOutOfBoundsException when connection is lost
Date Tue, 29 Mar 2016 00:35:25 GMT

     [ https://issues.apache.org/jira/browse/CURATOR-307?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jordan Zimmerman updated CURATOR-307:
-------------------------------------
    Fix Version/s: awaiting-response

> 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
>             Fix For: awaiting-response
>
>
> 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:
> {code:java}
> InterProcessMutex.acquire();
> doSomething();
> InterProcessMutex.release();
> {code}
> You can get following exception in release() method, when connection is lost after lock
is acquired.
> Stack trace:
> {code:java}
> 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)
> {code}
> and following stack trace when lock directory is empty (because emphemeral nodes are
deleted, because of connection was lost)
> {code:java}
> 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)
> {code}
> 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)

Mime
View raw message