[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-4625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17732340#comment-17732340
 ] 

Kezhu Wang commented on ZOOKEEPER-4625:
---------------------------------------

Just for information, an [rust 
client|https://github.com/kezhuw/zookeeper-client-rust] uses an [reference 
counting 
like|https://github.com/kezhuw/zookeeper-client-rust/blob/7466e867fb1b229d6b6ffb230e2e682c49ff494e/src/session/watch.rs#L368-L388]
 solution to overcome this. It only issues {{removeWatches}} if there are no 
more watchers with same watch mode on watching path(the code looks cumbersome 
as it has to deal with ZOOKEEPER-4472).

> No reliable way to remove watcher without interfering others in same watch 
> mode and on same path
> ------------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-4625
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4625
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: java client
>    Affects Versions: 3.8.0
>            Reporter: Kezhu Wang
>            Priority: Major
>
> It is possible that one node path could be watched more than once by 
> different watchers in same watch mode and same ZooKeeper session. 
> ZOOKEEPER-1910 reported this, but resorted to "checkWatches" to circumvent 
> this. It leaks watches untouched in server side.
> I think it might be possible do some tracking works in client to support 
> "removeWatches" without fearing client usages.
> Here are some links that lead to this issue:
>  * ZOOKEEPER-1910: RemoveWatches wrongly removes the watcher if multiple 
> watches exists on a path
>  * CURATOR-654: DistributedBarrier watcher leak and its 
> [pr|https://github.com/apache/curator/pull/435]
>  * [Why removeWatches sends OpCode.checkWatches to the 
> server?|https://lists.apache.org/thread/0kcnklcxs0s5656c1sbh3crgdodbb0qg] 
> from mailing list.
>  * [Drop for 
> watcher|https://github.com/kezhuw/zookeeper-client-rust/issues/2] from an 
> rust implementation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to