retry seems doesn't work in memcached driver when exceptions occur
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tooz |
New
|
Undecided
|
Unassigned |
Bug Description
The script is:
```python
from tooz import coordination
from tooz import _retry
from tooz.drivers import memcached as mem1
from oslo_utils import timeutils
import uuid
import time
import tenacity
from tenacity import *
import logging
import threading
import functools
import pdb
LOG = logging.
pdb.set_trace()
LOCK_TIMEOUT = 30
url = "memcached:
member_id = ("cinder-" + str(uuid.
coordinator = coordination.
url, member_id, lock_timeout=
)
coordinator.
lock_name = "uuid-delete_
# to get a lock
lock = coordinator.
@_retry.
@mem1._
def _acquire():
print("trying add lock %s", lock.name)
if lock.coord.
print("add lock success")
return True
raise _retry.TryAgain
# to acquire lock
_acquire()
lock.coord.
lock.release()
coordinator.stop()
```
when lock was got and was about to acquire lock, i shutdown the memcache server '100.101.
the result is:
```bash
(Pdb)
> /home/lz/
-> coordinator = coordination.
(Pdb)
> /home/lz/
-> url, member_id, lock_timeout=
(Pdb)
> /home/lz/
-> coordinator.
(Pdb)
> /home/lz/
-> lock_name = "uuid-delete_
(Pdb) c
trying add lock %s b'__TOOZ_
Traceback (most recent call last):
File "/home/
yield
File "/home/
return func(*args, **kwargs)
File "tes-memcache.py", line 47, in _acquire
noreply=False):
File "/home/
flags=flags)
File "/home/
flags=
File "/home/
buf, line = _readline(
File "/home/
raise MemcacheUnexpec
pymemcache.
```
When a temporary exception(like memcachedunexpe
summary: |
- retry seems doesn't work in memcached driver when trying to acquire lock + retry seems doesn't work in memcached driver when exceptions occur |
description: | updated |
# tooz._retry.retry
```python
import tenacity
from tenacity import stop
from tenacity import wait
_default_wait = wait.wait_ exponential( max=1)
def retry(stop_ max_delay= None, **kwargs): retry_never} after_delay( stop_max_ delay)
k = {"wait": _default_wait, "retry": tenacity.
if stop_max_delay not in (True, False, None):
k['stop'] = stop.stop_
return tenacity.retry(**k)
TryAgain = tenacity.TryAgain
```
Does ``"retry": tenacity. retry_never` ` necessary?