Skip to content

CURATOR-729: Fix PersistentWatcher dead loop after curator closed#520

Merged
kezhuw merged 1 commit intoapache:masterfrom
kezhuw:CURATOR-729-fix-PersistentWatcher-dead-loop
Jan 16, 2025
Merged

CURATOR-729: Fix PersistentWatcher dead loop after curator closed#520
kezhuw merged 1 commit intoapache:masterfrom
kezhuw:CURATOR-729-fix-PersistentWatcher-dead-loop

Conversation

@kezhuw
Copy link
Copy Markdown
Member

@kezhuw kezhuw commented Jan 8, 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

@frinda
Copy link
Copy Markdown

frinda commented Jan 9, 2025

LGTM

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
@kezhuw kezhuw force-pushed the CURATOR-729-fix-PersistentWatcher-dead-loop branch from 952f60e to 6879c39 Compare January 15, 2025 07:53
@kezhuw kezhuw merged commit 914f2f7 into apache:master 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants