[
https://issues.apache.org/jira/browse/ZOOKEEPER-5126?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated ZOOKEEPER-5126:
--------------------------------------
Labels: pull-request-available (was: )
> (C client) Async watch removals corrupt context and report false success
> ------------------------------------------------------------------------
>
> Key: ZOOKEEPER-5126
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-5126
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Reporter: Andrew Kyle Purtell
> Assignee: Andrew Kyle Purtell
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The C client's watch removal APIs have three related defects.
> First, in the multithreaded library, an asynchronous local removal through
> {{zoo_aremove_watches}} or {{zoo_aremove_all_watches}} treats the caller's
> context pointer as an internal synchronous-completion record. It locks a
> mutex, sets flags and signals a condition variable inside application memory.
> This corrupts the application's data and can hang the caller in
> {{{}pthread_mutex_lock{}}}.
> Second, the public header declares the completion parameter of both
> asynchronous functions as a pointer to a function pointer, not as a function
> pointer. A correctly typed callback is rejected by C++ compilers such as GCC
> 14 and later.
> Third, when the caller passes a NULL watcher (the remove-all case), the
> client treats the request as a match before it checks whether the path has
> any watches. A local remove-all then returnsĀ {{ZOK}} for a path with no
> watches, when the header promises {{ZNOWATCHER}} and the Java client throws
> {{{}NoWatcherException{}}}.
> All three defects are in the same API entry points, and they should be fixed
> together.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)