samuel / go-zookeeper

Native ZooKeeper client for Go. This project is no longer maintained. Please use https://github.com/go-zookeeper/zk instead.
BSD 3-Clause "New" or "Revised" License
1.64k stars 672 forks source link

Check and clean nodes which were created by the server, but client is not aware of it #237

Open ishveda opened 4 years ago

ishveda commented 4 years ago

If the node potentially was created by the server, but then client returned an error (e.g. ErrConnectionClose because of networking glitch), the node remains bound to the restored session and prevents acquisition of newer locks, since according to zk recipes for locks, there is a watch created on that node within the following lock, which dead locks further lock acquisition.

it fixes https://github.com/samuel/go-zookeeper/issues/229

coveralls commented 4 years ago

Coverage Status

Coverage increased (+0.9%) to 80.482% when pulling 64ed7173b5ed647f9b7fe7c7adf518a67178f89c on ishveda:clean-obsolete-nodes into 2cc03de413da42869e2db7ce7965d3e978d917eb on samuel:master.