CURATOR-729: Fix PersistentWatcher dead loop after curator closed#520
Merged
kezhuw merged 1 commit intoapache:masterfrom Jan 16, 2025
Merged
Conversation
|
LGTM |
tisonkun
reviewed
Jan 14, 2025
The dead loop is multifold: 1. `CuratorFramework::watchers` does not check `CuratorFrameworkState` as `getData` or others do. 2. `PersistentWatcher` loops itself through `reset` in `BackgroundCallback`. 3. Callback in `inBackground(callback).forPath(path)` is invoked synchronously. This commit enforces `CuratorFrameworkState` checking also to `watchers`, `watches`, `sync`, `reconfig` and `getConfig`. Additionally, this commit will issue `KeeperState.Closed` to listeners of `PersistentWatcher` when curator get closed. This is not required to fix CURATOR-729, but will make the closing behavior consistent with ZooKeeper. Also, I think it is good for asynchronous `Watcher`. Refs: CURATOR-529, CURATOR-673
952f60e to
6879c39
Compare
tisonkun
approved these changes
Jan 16, 2025
kezhuw
added a commit
to kezhuw/curator
that referenced
this pull request
Apr 7, 2025
`NamespaceFacade` does not support `getCuratorListenable` while apache#520 use it to listen for `CuratorEventType.CLOSING` to fix CURATOR-729. This commit exports `CuratorFrameworkBase::client` to retrieve underlying framework client to listen for for `CuratorEventType.CLOSING`. Fixes apache#1259.
kezhuw
added a commit
that referenced
this pull request
Apr 12, 2025
`NamespaceFacade` does not support `getCuratorListenable` while #520 use it to listen for `CuratorEventType.CLOSING` to fix CURATOR-729. This commit exports `CuratorFrameworkBase::client` to retrieve underlying framework client to listen for for `CuratorEventType.CLOSING`. Fixes #1259.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The dead loop is multifold:
CuratorFramework::watchersdoes not checkCuratorFrameworkStateasgetDataor others do.PersistentWatcherloops itself throughresetinBackgroundCallback.inBackground(callback).forPath(path)is invoked synchronously.This commit enforces
CuratorFrameworkStatechecking also towatchers,watches,sync,reconfigandgetConfig.Additionally, this commit will issue
KeeperState.Closedto listeners ofPersistentWatcherwhen curator get closed. This is not required to fix CURATOR-729, but will make the closing behavior consistent with ZooKeeper. Also, I think it is good for asynchronousWatcher.Refs: CURATOR-529, CURATOR-673