zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hetzner <erik.hetz...@ucop.edu>
Subject Problem with WriteLock
Date Wed, 09 Mar 2011 23:14:26 GMT
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


Mime
View raw message