Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Distributed lock cleanup ( ILock.destroy() )
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  13 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Chris70  
View profile   Translate to Translated (View Original)
 More options Aug 23 2012, 4:18 pm
From: Chris70 <chris.he...@gmail.com>
Date: Thu, 23 Aug 2012 13:18:55 -0700 (PDT)
Local: Thurs, Aug 23 2012 4:18 pm
Subject: Distributed lock cleanup ( ILock.destroy() )

If thread 1 acquires distributed lock("foo"), thread 2 attempts to acquire
and waits on lock("foo") because thread 1 has it locked, then thread 1
calls destroy on lock("foo"), does thread 2 successfully acquire
lock("foo") or does something more "sinister" happen? So something like...

*Thread 1:*
ILock lock = Hazelcast.getLock("foo");
lock.lock();
// Do something
lock.destroy();

*Thread 2:*
ILock lock = Hazelcast.getLock("foo");
lock.lock();
// Do something
lock.destroy();

The point is, we'd like to clean up our locks as their released. Our
original implementation in 2.1.2 was using an IMap-based lock, but this
proved erroneous (we believe saw two different threads acquiring the same
lock) due to what we perceive to be related to issue
 https://github.com/hazelcast/hazelcast/issues/223


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Enes Akar  
View profile   Translate to Translated (View Original)
 More options Aug 24 2012, 2:53 am
From: Enes Akar <e...@hazelcast.com>
Date: Fri, 24 Aug 2012 09:53:18 +0300
Local: Fri, Aug 24 2012 2:53 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

"two different threads acquiring the same lock" is more serious problem
that we should firstly focus
as Lock object uses Map's lock mechanism on background.

The issue 233 is fixed and closed.
Is there any scenario that can help us to reproduce the problem?

Currently, destroy does not release the lock, you can file an issue
regarding this.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris70  
View profile   Translate to Translated (View Original)
 More options Aug 24 2012, 10:23 am
From: Chris70 <chris.he...@gmail.com>
Date: Fri, 24 Aug 2012 07:23:20 -0700 (PDT)
Local: Fri, Aug 24 2012 10:23 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

To be clear, we changed our code to use a Distributed Lock whereas
previously we were seeing issues with the IMap-based lock. We made no code
change other than to substitute the IMap-based lock with the Distributed
Lock, but this was enough to fix the issue for us (or at least mask the
root issue). What led us to try a Distributed Lock in lieu of an IMap-based
lock is issue 223 (not issue 233) which we know is to directly fix an issue
with MultiMap, but the fix appeared to be to components that are shared w/
Map.

I'll attempt to describe below the scenario we think we're seeing. We don't
know if the scenario is accurate in terms of the exact sequence of events.
Obviously if the lock isn't respected, the events could occur in a
different order. The issue is always reproducible in our system.
- Thread 1 acquires lock "foo". Key "foo" is not yet an entry in the IMap,
so it puts a value in for "foo", and then releases the lock.
- Thread 2, 3, 4 look to acquire lock "foo"
- Thread 2 acquires lock "foo", sees there's a value for "foo", registers
an EntryListener, and then releases the lock.
- Thread 3 acquires lock "foo", sees there's a value for "foo", adds a
listener to thread 2, and then releases the lock.
- Thread 4 acquires lock "foo", removes "foo" from the map, and then
unlocks "foo".

We haven't found evidence that any of the threads successfully acquire lock
"foo" while another thread holds it, though we suspect it to be the case.
We're still investigating. The issue we suspect is thread 4 successfully
acquires lock "foo" while thread 3 holds it. Meanwhile, it's possible that
thread 4 removes "foo" from the map before thread 3 can register its
listener on thread 2 and thus thread 3 never gets a callback. We completely
rely on the lock "foo" to synchronize these operations.

Finally, we haven't tried running w/ the fix for issue 223, so we have no
reason to believe that patch fixes the underlying issue. It may not be
relevant. Is it worth trying the fix for 223 or are you convinced it has no
relevance to our use case?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mehmet Dogan  
View profile   Translate to Translated (View Original)
 More options Aug 24 2012, 12:37 pm
From: Mehmet Dogan <meh...@hazelcast.com>
Date: Fri, 24 Aug 2012 19:37:23 +0300
Local: Fri, Aug 24 2012 12:37 pm
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Both issue 223 and 228 are related to removal of a locked entry which
applies to both IMap and MultiMap. Problem was that when a locked entry is
removed and then unlocked, threads blocked while trying to acquire that
lock were not able to get notification and were remaining blocked
infinitely.

Since you are removing and unlocking an entry, it might be that you are
encountering the same problem. And your fix (replacing IMap locks with
external ILocks) seems to me a workaround for thread-4's operation,
lock-remove-unlock.

If building your app using 2.3 (master branch) is not a hard process for
you and if this issue is easily reproducible in your system, then it is
worth trying. It will show us either 2.3 has fixed your issue or we have a
serious lock issue waiting to be solved before releasing 2.3.

@mmdogan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris70  
View profile  
 More options Aug 29 2012, 9:26 am
From: Chris70 <chris.he...@gmail.com>
Date: Wed, 29 Aug 2012 06:26:35 -0700 (PDT)
Local: Wed, Aug 29 2012 9:26 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Hazelcast 2.3 appears to have fixed the issue we saw when using a map-based lock.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mehmet Dogan  
View profile  
 More options Aug 30 2012, 11:38 am
From: Mehmet Dogan <meh...@hazelcast.com>
Date: Thu, 30 Aug 2012 18:38:09 +0300
Local: Thurs, Aug 30 2012 11:38 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Can you post a test case/app to be able to reproduce issue on our side? Or
at least code snippets of operations those are using locks/maps?

@mmdogan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris70  
View profile  
 More options Aug 31 2012, 8:29 am
From: Chris70 <chris.he...@gmail.com>
Date: Fri, 31 Aug 2012 05:29:33 -0700 (PDT)
Local: Fri, Aug 31 2012 8:29 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

I had retracted my reply. Will post back if I have more info on this.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Timur E  
View profile  
 More options Sep 7 2012, 6:47 am
From: Timur E <eblov...@gmail.com>
Date: Fri, 7 Sep 2012 03:47:44 -0700 (PDT)
Local: Fri, Sep 7 2012 6:47 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Have got similar issue, running Hazelcast 2.2 on Oracle JDK 1.7.0-05 Linux
x86-64.

java.lang.IllegalMonitorStateException: Current thread is not owner of the
lock!
at com.hazelcast.impl.MProxyImpl$MProxyReal.unlock(MProxyImpl.java:717)
at sun.reflect.GeneratedMethodAccessor462.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp l.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.hazelcast.impl.MProxyImpl$DynamicInvoker.invoke(MProxyImpl.java:66)
at $Proxy514.unlock(Unknown Source)
at com.hazelcast.impl.MProxyImpl.unlock(MProxyImpl.java:405)
at
com.hazelcast.impl.LockProxyImpl$LockProxyBase.unlock(LockProxyImpl.java:20 2)
at com.hazelcast.impl.LockProxyImpl.unlock(LockProxyImpl.java:116)

It needs a load test to reproduce.

Most interesting observation:
The *very same* application runs without this error (production, quite
heavy load) on Oracle JDK 1.6.0-29 Linux x86-64.

пятница, 31 августа 2012 г., 14:29:33 UTC+2 пользователь Chris70 написал:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mehmet Dogan  
View profile  
 More options Sep 7 2012, 7:54 am
From: Mehmet Dogan <meh...@hazelcast.com>
Date: Fri, 7 Sep 2012 14:54:03 +0300
Local: Fri, Sep 7 2012 7:54 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Can you try using version 2.3? If you can reproduce even using 2.3, can you
post a test-case?

@mmdogan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eblov...@gmail.com  
View profile  
 More options Sep 7 2012, 11:01 am
From: eblov...@gmail.com
Date: Fri, 7 Sep 2012 08:01:20 -0700 (PDT)
Local: Fri, Sep 7 2012 11:01 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Running test with 2.3, seen no issues so far.
Will update you Monday.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eblov...@gmail.com  
View profile  
 More options Sep 9 2012, 3:36 am
From: eblov...@gmail.com
Date: Sun, 9 Sep 2012 00:36:15 -0700 (PDT)
Local: Sun, Sep 9 2012 3:36 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Tried with 2.3, far fewer issues than with 2.2 (4 occurences on 300000
invocations, in concurrent test with 2000 clients), but still not zero :(

Is there any logging/stats on the current lock state that we could
retrieve? To understand which thread is holding the lock, instead of the
current one?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
eblov...@gmail.com  
View profile  
 More options Sep 9 2012, 3:37 am
From: eblov...@gmail.com
Date: Sun, 9 Sep 2012 00:37:01 -0700 (PDT)
Local: Sun, Sep 9 2012 3:37 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )
 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mehmet Dogan  
View profile  
 More options Sep 10 2012, 9:29 am
From: Mehmet Dogan <meh...@hazelcast.com>
Date: Mon, 10 Sep 2012 16:29:23 +0300
Local: Mon, Sep 10 2012 9:29 am
Subject: Re: Distributed lock cleanup ( ILock.destroy() )

Thanks for the info.

I am able to reproduce this issue. As you said, this is a quite elusive
race condition. (Increasing execution frequency of cleanup thread helps to
much here.) Problem appears both on jdk6 and jd7.

I have also a fix and will push after some testing. (I hope this will solve
Chris's problem too.)

@mmdogan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »