You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by "Kim Jaechang (JIRA)" <ji...@apache.org> on 2019/06/05 12:01:00 UTC

[jira] [Updated] (CURATOR-527) Concurrency issue in LockInternals

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

Kim Jaechang updated CURATOR-527:
---------------------------------
    Description: 
I'm using InterProcessMutex and InterProcessMutex often failed to acquire lock.

In LockInternals.internalLockLoop, watcher is registered to zookeeper and call wait() like below
{code:java}
client.getData().usingWatcher(watcher).forPath(previousSequencePath);
if ( millisToWait != null )
{
    millisToWait -= (System.currentTimeMillis() - startMillis);
    startMillis = System.currentTimeMillis();
    if ( millisToWait <= 0 )
    {
        doDelete = true;    // timed out - delete our node
        break;
    }

    wait(millisToWait);
}
else
{
    wait();
}
{code}
In my case, my program is waiting previousSequencePath=_c_50f10103-c19e-45f4-8cc3-ba686ea452fe-lock-0000000760 to be deleted.

But _c_50f10103-c19e-45f4-8cc3-ba686ea452fe-lock-0000000760 is deleted before wait() is called.

if _c_50f10103-c19e-45f4-8cc3-ba686ea452fe-lock-0000000760 is deleted when 
client.getData().usingWatcher(watcher).forPath(previousSequencePath) is called, it will throw Exception but it was exist at that time.

I'm using Curator 2.12.0 but latest version seems to have same issue.

  was:I'm using InterProcessMutex and InterProcessMutex often failed to acquire lock.


> Concurrency issue in LockInternals
> ----------------------------------
>
>                 Key: CURATOR-527
>                 URL: https://issues.apache.org/jira/browse/CURATOR-527
>             Project: Apache Curator
>          Issue Type: Bug
>          Components: Recipes
>    Affects Versions: 2.12.0
>            Reporter: Kim Jaechang
>            Priority: Major
>
> I'm using InterProcessMutex and InterProcessMutex often failed to acquire lock.
> In LockInternals.internalLockLoop, watcher is registered to zookeeper and call wait() like below
> {code:java}
> client.getData().usingWatcher(watcher).forPath(previousSequencePath);
> if ( millisToWait != null )
> {
>     millisToWait -= (System.currentTimeMillis() - startMillis);
>     startMillis = System.currentTimeMillis();
>     if ( millisToWait <= 0 )
>     {
>         doDelete = true;    // timed out - delete our node
>         break;
>     }
>     wait(millisToWait);
> }
> else
> {
>     wait();
> }
> {code}
> In my case, my program is waiting previousSequencePath=_c_50f10103-c19e-45f4-8cc3-ba686ea452fe-lock-0000000760 to be deleted.
> But _c_50f10103-c19e-45f4-8cc3-ba686ea452fe-lock-0000000760 is deleted before wait() is called.
> if _c_50f10103-c19e-45f4-8cc3-ba686ea452fe-lock-0000000760 is deleted when 
> client.getData().usingWatcher(watcher).forPath(previousSequencePath) is called, it will throw Exception but it was exist at that time.
> I'm using Curator 2.12.0 but latest version seems to have same issue.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)