zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Fines <scottfi...@gmail.com>
Subject Re: Problem with WriteLock
Date Thu, 10 Mar 2011 00:48:11 GMT
Could you send on a link to your WriteLock implementation?

Also, have you considered using the locks provided in
menagerie<https://github.com/openUtility/menagerie>
 or KeptCollections <https://github.com/anthonyu/KeptCollections>? They may
or may not provide the features that you are interested in, but still worth
checking out.

Scott

On Wed, Mar 9, 2011 at 5:14 PM, Erik Hetzner <erik.hetzner@ucop.edu> wrote:

> Hi,
>
> I am attempting to use the WriteLock recipe provided with ZK 3.3.2.
> Unfortunately, I seem to be deadlocking when I try to lock from
> multiple threads. If I lock sequentially, I have no trouble. Can
> somebody let me know what I am doing wrong here? I am attaching some
> sample code; I can also provide a complete maven project to test if
> necessary. (For the record, I have increased maxClientCnxns in my
> zoo.cfg to 100.)
>
> Here we see the results without threading:
>
>  $ time java -cp "lib/*" Test nothread
>  […]
>  finished 9
>
>  real  0m1.361s
>  user  0m0.380s
>  sys   0m0.050s
>
> And here is the threaded version:
>
>  $ time java -cp "lib/*" Test thread
>  finished 9
>  finished 8
>  finished 1
>  ^C
>  real  3m4.627s
>  user  0m4.600s
>  sys   0m2.060s
>
> On the other hand, it does not always deadlock:
>
>  $ time java -cp "lib/*" Test thread
>  finished 4
>  finished 0
>  finished 3
>  finished 5
>  finished 6
>  finished 7
>  finished 2
>  finished 1
>  finished 8
>  finished 9
>
>  real  0m7.824s
>  user  0m1.030s
>  sys   0m0.170s
>
> Thanks for any help you can provide!
>
> best, Erik Hetzner
>
>
> Sent from my free software system <http://fsf.org/>.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message