You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Edward Capriolo <ed...@huffingtonpost.com> on 2015/02/25 22:22:58 UTC

Re: Bug with ZKWriteLock recipe

Just for reference I fixed my fork to handle the above problem:

A new things tends to crop of less frequently:
2015-02-25 20:01:49 WARN  WriteLock:240 - Could not find the stats for less
than me: /teknek/locks/tocassandra/x-237496960065273856-0002061880

The lock recipe seems unable to recover from this case as well. buyer beware



On Fri, Jan 30, 2015 at 3:28 PM, Edward Capriolo <
edward.capriolo@huffingtonpost.com> wrote:

>
> http://svn.apache.org/repos/asf/zookeeper/trunk/src/recipes/lock/src/java/org/apache/zookeeper/recipes/lock/
>
> So there is a bug in the above code ( I think)
>
> WARN 10:08:31,468 attempting to unlock x-93233511378059273-0000000002
> DEBUG 10:08:31,468 234f44a4-7f6e-4f19-962b-fb9a7b64f6c4 released
> WARN 10:08:31,469 Unable to unlock/cleanup. hadlock?false
> java.lang.IllegalArgumentException: Path must start with / character
> at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:51)
> at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:846)
> at
> org.apache.zookeeper.recipes.lock.WriteLock$1.execute(WriteLock.java:120)
> at org.apache.zookeeper.recipes.lock.WriteLock.unlock(WriteLock.java:124)
> at io.teknek.daemon.TeknekDaemon.considerStarting(TeknekDaemon.java:277)
> at io.teknek.daemon.TeknekDaemon.access$4(TeknekDaemon.java:211)
> at io.teknek.daemon.TeknekDaemon$2.run(TeknekDaemon.java:126)
>
> The bug seems to be if the latch is not acquired unlock gets the from path.
>
>
> https://github.com/edwardcapriolo/teknek-core/commit/747174f7b04a570e13583542a9e7ef3029f7bcf6
>
> Basically with two concurrent users of the lock you see this quite often.
>
> Q.Theses lock recipes seem a bit crude...no offense... I can send a patch.
> But I wonder if no one is maintaining these maybe they should be removed
> (and curator recipes) suggested instead.
>
>

Re: Bug with ZKWriteLock recipe

Posted by Edward Capriolo <ed...@huffingtonpost.com>.
"Let me also add that the curator recipes are probably more robust at this
point."

I agree. If you replace the word "probably" with "absolutely". The issue
you mention (ZK-645) dates back to 15/Jan/10 05:19, I can see it has one of
the fixes I already found. I would suggest removing the lock recipe
entirely, because it can not be relied on in any way. I am not even
convinced it locks anything.

On Wed, Feb 25, 2015 at 4:34 PM, Flavio Junqueira <
fpjunqueira@yahoo.com.invalid> wrote:

> Hi Edward,
>
> Do you know if this is related to the issue described in ZK-645? If you
> have time, perhaps contribute a patch either for that issue including your
> fix or a separate issue only for your fix.
>
> Let me also add that the curator recipes are probably more robust at this
> point.
>
> Thanks,
> -Flavio
>
>
> > On 25 Feb 2015, at 21:22, Edward Capriolo <
> edward.capriolo@huffingtonpost.com> wrote:
> >
> > Just for reference I fixed my fork to handle the above problem:
> >
> > A new things tends to crop of less frequently:
> > 2015-02-25 20:01:49 WARN  WriteLock:240 - Could not find the stats for
> less
> > than me: /teknek/locks/tocassandra/x-237496960065273856-0002061880
> >
> > The lock recipe seems unable to recover from this case as well. buyer
> beware
> >
> >
> >
> > On Fri, Jan 30, 2015 at 3:28 PM, Edward Capriolo <
> > edward.capriolo@huffingtonpost.com> wrote:
> >
> >>
> >>
> http://svn.apache.org/repos/asf/zookeeper/trunk/src/recipes/lock/src/java/org/apache/zookeeper/recipes/lock/
> >>
> >> So there is a bug in the above code ( I think)
> >>
> >> WARN 10:08:31,468 attempting to unlock x-93233511378059273-0000000002
> >> DEBUG 10:08:31,468 234f44a4-7f6e-4f19-962b-fb9a7b64f6c4 released
> >> WARN 10:08:31,469 Unable to unlock/cleanup. hadlock?false
> >> java.lang.IllegalArgumentException: Path must start with / character
> >> at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:51)
> >> at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:846)
> >> at
> >>
> org.apache.zookeeper.recipes.lock.WriteLock$1.execute(WriteLock.java:120)
> >> at
> org.apache.zookeeper.recipes.lock.WriteLock.unlock(WriteLock.java:124)
> >> at io.teknek.daemon.TeknekDaemon.considerStarting(TeknekDaemon.java:277)
> >> at io.teknek.daemon.TeknekDaemon.access$4(TeknekDaemon.java:211)
> >> at io.teknek.daemon.TeknekDaemon$2.run(TeknekDaemon.java:126)
> >>
> >> The bug seems to be if the latch is not acquired unlock gets the from
> path.
> >>
> >>
> >>
> https://github.com/edwardcapriolo/teknek-core/commit/747174f7b04a570e13583542a9e7ef3029f7bcf6
> >>
> >> Basically with two concurrent users of the lock you see this quite
> often.
> >>
> >> Q.Theses lock recipes seem a bit crude...no offense... I can send a
> patch.
> >> But I wonder if no one is maintaining these maybe they should be removed
> >> (and curator recipes) suggested instead.
> >>
> >>
>
>

Re: Bug with ZKWriteLock recipe

Posted by Flavio Junqueira <fp...@yahoo.com.INVALID>.
Hi Edward,

Do you know if this is related to the issue described in ZK-645? If you have time, perhaps contribute a patch either for that issue including your fix or a separate issue only for your fix. 

Let me also add that the curator recipes are probably more robust at this point.

Thanks,
-Flavio


> On 25 Feb 2015, at 21:22, Edward Capriolo <ed...@huffingtonpost.com> wrote:
> 
> Just for reference I fixed my fork to handle the above problem:
> 
> A new things tends to crop of less frequently:
> 2015-02-25 20:01:49 WARN  WriteLock:240 - Could not find the stats for less
> than me: /teknek/locks/tocassandra/x-237496960065273856-0002061880
> 
> The lock recipe seems unable to recover from this case as well. buyer beware
> 
> 
> 
> On Fri, Jan 30, 2015 at 3:28 PM, Edward Capriolo <
> edward.capriolo@huffingtonpost.com> wrote:
> 
>> 
>> http://svn.apache.org/repos/asf/zookeeper/trunk/src/recipes/lock/src/java/org/apache/zookeeper/recipes/lock/
>> 
>> So there is a bug in the above code ( I think)
>> 
>> WARN 10:08:31,468 attempting to unlock x-93233511378059273-0000000002
>> DEBUG 10:08:31,468 234f44a4-7f6e-4f19-962b-fb9a7b64f6c4 released
>> WARN 10:08:31,469 Unable to unlock/cleanup. hadlock?false
>> java.lang.IllegalArgumentException: Path must start with / character
>> at org.apache.zookeeper.common.PathUtils.validatePath(PathUtils.java:51)
>> at org.apache.zookeeper.ZooKeeper.delete(ZooKeeper.java:846)
>> at
>> org.apache.zookeeper.recipes.lock.WriteLock$1.execute(WriteLock.java:120)
>> at org.apache.zookeeper.recipes.lock.WriteLock.unlock(WriteLock.java:124)
>> at io.teknek.daemon.TeknekDaemon.considerStarting(TeknekDaemon.java:277)
>> at io.teknek.daemon.TeknekDaemon.access$4(TeknekDaemon.java:211)
>> at io.teknek.daemon.TeknekDaemon$2.run(TeknekDaemon.java:126)
>> 
>> The bug seems to be if the latch is not acquired unlock gets the from path.
>> 
>> 
>> https://github.com/edwardcapriolo/teknek-core/commit/747174f7b04a570e13583542a9e7ef3029f7bcf6
>> 
>> Basically with two concurrent users of the lock you see this quite often.
>> 
>> Q.Theses lock recipes seem a bit crude...no offense... I can send a patch.
>> But I wonder if no one is maintaining these maybe they should be removed
>> (and curator recipes) suggested instead.
>> 
>>