jplana / python-etcd

A python client for etcd
Other
522 stars 210 forks source link

locks with ttls are broken #267

Open Roguelazer opened 5 years ago

Roguelazer commented 5 years ago

In the _acquired function of lock.py, the code first sets a key, then calls watch with no timeout. If the lock is held by a peer who ever calls renew(), this causes an uncaught exception.

Specifically, if you're using TTLs, the key might expire before the watch returns, which causes the later call to _acquired to fail.

The whole idea of having a recursive function which contains an infinite loop is kind of hinky.