Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

locking with python3-etcd3 0.12.0 on etcd 3.4.23 fails? #2149

Open
jimrobinson opened this issue Apr 6, 2023 · 4 comments
Open

locking with python3-etcd3 0.12.0 on etcd 3.4.23 fails? #2149

jimrobinson opened this issue Apr 6, 2023 · 4 comments

Comments

@jimrobinson
Copy link

I'm using a test cluster of three etcd nodes running etcd version 3.4.23.

When using python etcd3==0.12.0 my attempts to test etcd3 locks (see test_lock.txt) across multiple processes blows up, with different errors depending on which version of tenacity I'm using. With the following:

etcd3==0.12.0
grpcio==1.53.0
protobuf==3.20.3
six==1.16.0
tenacity==8.2.2

I get the error:

Traceback (most recent call last):
  File "/app/./test_lock.py", line 24, in <module>
    p.map(test_lock, [i+nid for i in range(nproc)])
  File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 771, in get
    raise self._value
TypeError: Lock.acquire.<locals>.wait() missing 1 required positional argument: 'delay_since_first_attempt'

and with a lower version of tenacity:

etcd3==0.12.0
grpcio==1.53.0
protobuf==3.20.3
six==1.16.0
tenacity==8.1.0

I get the error

Traceback (most recent call last):
  File "/app/./test_lock.py", line 24, in <module>
    p.map(test_lock, [i+nid for i in range(nproc)])
  File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 771, in get
    raise self._value
TypeError: Lock.acquire.<locals>.wait() got an unexpected keyword argument 'retry_state'

Installing python-etcd3 from the master branch (using pip install git+https://github.com/kragniz/python-etcd3) appears to resolve the issue, so:

etcd3 @ git+https://github.com/kragniz/python-etcd3@e58a899579ba416449c4e225b61f039457c8072a
grpcio==1.53.0
protobuf==3.20.3
six==1.16.0

appears to work fine:

python3 ./test_lock.py
does 1 have the lock? True
does 2 have the lock? True
does 3 have the lock? True
does 4 have the lock? True
@zignd
Copy link

zignd commented May 8, 2023

I'm also getting the same error when I try to use Lock.acquire() on a lock that is already locked. So I decided to investigate and this is what I found:

  • It seems that the library code published as 0.12.0 is from Mar 31, 2020 and it uses this tenacity library to handle the retries inside the acquire method.
  • The code in the master branch has a change from Apr 9, 2020 (one month later) which can be seen in this pull request in which the author removes tenacity mentioning some sort of issue that he was not able to fix.

@zignd
Copy link

zignd commented May 8, 2023

@kragniz would you mind publishing the library again please considering that the changes in the master branch seem to fix this issue?

@wws0222
Copy link

wws0222 commented Jan 30, 2024

Can a new version of the newly added MR be released?

@jameszrx
Copy link

Is this issue resolved yet? I am still hitting the same issue when using 0.12.0, and this issue exists in 0.11.0, 0.10.0, and directly taking dependency on master branch in production use cases is something I'd only take as the last resort. @kragniz, can you or other maintainers release a new package version with the fix? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants