Timeouts on lock

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Timeouts on lock

Alexei
Hello!

We have 3 nodes Zoo cluster running 3.4.5+dfsg-1 on ubuntu 14. Client is python with 1.2.1 and (tried) 2.4.0 python-kazoo

When I run simple script which set lock in loop it starts to time out after 1 or 2 set locks.
What am I doing wrong?

Script is here: http://paste.org.ru/?xqlivn
Log is here: http://paste.org.ru/?zwr6u1

root@zk-gce-eu-2:~# echo mntr | nc -v localhost 2181                                                                                                                                                        
Connection to localhost 2181 port [tcp/*] succeeded!
zk_version      3.4.5--1, built on 06/10/2013 17:26 GMT
zk_avg_latency  0
zk_max_latency  203
zk_min_latency  0
zk_packets_received     2741185
zk_packets_sent 2963217
zk_num_alive_connections        24
zk_outstanding_requests 0
zk_server_state leader
zk_znode_count  51
zk_watch_count  5
zk_ephemerals_count     44
zk_approximate_data_size        4770
zk_open_file_descriptor_count   68
zk_max_file_descriptor_count    8192
zk_followers    2
zk_synced_followers     2
zk_pending_syncs        0



Thank you.

--
Grats, Alex.

Reply | Threaded
Open this post in threaded view
|

Re: Timeouts on lock

Andor Molnar
Hi Alexei,

I think this is more of a Kazoo lock recipe question and not ZooKeeper
specific, but I did some research for you:

It seems that Kazoo locks are based on the path parameter that you specify
when creating a new lock object and _not_ the identifier (name in your
case). So basically second call (should) timeouts, because you're trying to
acquire the same lock 10 times. Changing the code to use PATH as a prefix
and concatenate with the random name fixes it:

PATH = "aggregator_test/"

lock = zoo_conn.Lock(PATH + name)

Regards,
Andor



On Wed, Jan 31, 2018 at 1:10 PM, Alexei <[hidden email]> wrote:

> Hello!
>
> We have 3 nodes Zoo cluster running 3.4.5+dfsg-1 on ubuntu 14. Client is
> python with 1.2.1 and (tried) 2.4.0 python-kazoo
>
> When I run simple script which set lock in loop it starts to time out
> after 1 or 2 set locks.
> What am I doing wrong?
>
> Script is here: http://paste.org.ru/?xqlivn
> Log is here: http://paste.org.ru/?zwr6u1
>
> root@zk-gce-eu-2:~# echo mntr | nc -v localhost 2181
> Connection to localhost 2181 port [tcp/*] succeeded!
> zk_version      3.4.5--1, built on 06/10/2013 17:26 GMT
> zk_avg_latency  0
> zk_max_latency  203
> zk_min_latency  0
> zk_packets_received     2741185
> zk_packets_sent 2963217
> zk_num_alive_connections        24
> zk_outstanding_requests 0
> zk_server_state leader
> zk_znode_count  51
> zk_watch_count  5
> zk_ephemerals_count     44
> zk_approximate_data_size        4770
> zk_open_file_descriptor_count   68
> zk_max_file_descriptor_count    8192
> zk_followers    2
> zk_synced_followers     2
> zk_pending_syncs        0
>
>
>
> Thank you.
>
> --
> Grats, Alex.
>
>