Skip to content

[BUG] Stale cluster state in Lookuper lookup - #451

Merged
leekeiabstraction merged 1 commit into
apache:mainfrom
fresh-borzoni:fix-race-lookuper
Mar 28, 2026
Merged

[BUG] Stale cluster state in Lookuper lookup#451
leekeiabstraction merged 1 commit into
apache:mainfrom
fresh-borzoni:fix-race-lookuper

Conversation

@fresh-borzoni

@fresh-borzoni fresh-borzoni commented Mar 24, 2026

Copy link
Copy Markdown
Member

Lookuper::lookup() captures a cluster state before calling leader_for(), then uses that state to resolve the leader's server. If leader_for() refreshed metadata internally (cache miss -> coordinator RPC), the returned leader could reference a server absent from the stale state, causing a spurious "server not found" error during leader transitions.

Proposed fix: connect to the ServerNode returned by leader_for() directly as it already contains host and port.
Removes the redundant cluster state lookup and the race entirely.

@fresh-borzoni

Copy link
Copy Markdown
Member Author

@luoyuxia @leekeiabstraction PTAL

@fresh-borzoni fresh-borzoni changed the title [BUG] Fix possible TOCTOU race between leader discovery and server lo… [BUG] Stale cluster snapshot in Lookuper lookup Mar 24, 2026
@fresh-borzoni fresh-borzoni changed the title [BUG] Stale cluster snapshot in Lookuper lookup [BUG] Stale Stale cluster state in Lookuper lookup Mar 24, 2026
@fresh-borzoni fresh-borzoni changed the title [BUG] Stale Stale cluster state in Lookuper lookup [BUG] Stale cluster state in Lookuper lookup Mar 24, 2026

@leekeiabstraction leekeiabstraction left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY for the PR!

@leekeiabstraction
leekeiabstraction merged commit 51bd65a into apache:main Mar 28, 2026
4 checks passed
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.

2 participants