Closed tobegit3hub closed 7 years ago
Try to workaround and set timeout like this 😞
import sys
self.client.watch(self.master_key, timeout=sys.maxint)
hi @tobegit3hub I most definitely never had this problem. More specifically, I have a etcd replication tool running in production that watches etcd for hours when I don't set any timeout.
Even my local tests never showed such a behaviour.
So I am at a loss: which version of python/urrlib3/etcd are you using?
Thanks @lavagetto .
It's easy to re-produced in my hosts with CentOS 7.0
, python 2.7.5
, urllib3 1.19.1
and etcd 3.0.15 git sha: fc00305
.
And using timeout=sys.maxint
will work for us.
@tobegit3hub sorry, I just realized that setting no timeout means the default urllib3 read timeout will be enforced.
You should explicitly set the timeout to 0 here:
c = etcd.Client(port=2379)
c.read('/', wait=True) #will cause the timeout error
c.read('/', wait=True, timeout=0) #will wait forever
That makes sense and 0
works for me.
Thanks @lavagetto very much!
We have use
python-etcd
for leader election. All the workers will watch the same key inetcd
and try to elect the leader after the key dismissed.Now we try to watch the key and set the timeout as
None
.But after almost one minute, the salve worker throws timeout exception and exit.
If we set the timeout as
3600
, it will be much better and will not exit soon. But that's not what we want. Not sure if it's the bug ofpython-etcd
to watch the key forever.May be similar to https://github.com/jplana/python-etcd/issues/202