Lock.release() always fails in python 3.6.6 (Redis-py 2.10.5)
See original GitHub issue>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=6, micro=6, releaselevel='final', serial=0)
>>> import redis
>>> redis.__version__
'2.10.5'
>>> redis_connection = redis.StrictRedis(host='redis', port=6379, decode_responses=True)
>>> lock = redis.lock.Lock(redis_connection, 'aa29f76d-f2be-4acb-abd8-7e74a336ceda')
>>> lock.acquire()
True
>>> lock.release()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/redis/lock.py", line 135, in release
self.do_release(expected_token)
File "/usr/local/lib/python3.6/dist-packages/redis/lock.py", line 146, in do_release
self.redis.transaction(execute_release, name)
File "/usr/local/lib/python3.6/dist-packages/redis/client.py", line 490, in transaction
func_value = func(pipe)
File "/usr/local/lib/python3.6/dist-packages/redis/lock.py", line 143, in execute_release
raise LockError("Cannot release a lock that's no longer owned")
redis.exceptions.LockError: Cannot release a lock that's no longer owned
>>>
Redis-py Version: 2.10.5 Python Version: 3.6.6
The functionality used to work in python 2.7, but now simply acquiring and releasing a lock fails. I tried in with block as well with same result.
Am I doing something wrong or is this a bug? Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Lock.release() always fails in python 3.6.6 (Redis-py 2.10.5)
The functionality used to work in python 2.7, but now simply acquiring and releasing a lock fails. I tried in with block as...
Read more >xadd not found with redis py 2.10.5 - Stack Overflow
You're using too old client, RedisPy 2.10.5 was released in 2015. XADD is a stream feature that has been released in Redis 5.0...
Read more >redis-py-cluster Documentation
It has been found that the python module name that is used in this library (rediscluster) is already shared with a similar but...
Read more >redis-py-cluster Documentation - Read the Docs
Since Python 3 changed to Unicode strings from Python 2's ASCII, the return type of most commands will be binary strings, unless the...
Read more >redis - PyPI
redis-py. The Python interface to the Redis key-value store. CI docs MIT licensed pypi pre-release codecov. Installation | Usage | Advanced Topics | ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@benileo I can replicate this issue on that version. The reason is a type mismatch when comparing the local token with the expected token here. For example:
I suspect a newer version fixes this issue.
I observe same behaviour in 2.10.6. I think an upgrade to 3.0+ is very likely 😃