FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Claim exact idle generation before closing pooled channels by hyperxpro · Pull Request #2298 · AsyncHttpClient/async-http-client · GitHub

Claim exact idle generation before closing pooled channels - #2298

Merged
hyperxpro merged 1 commit into
mainfrom
fix/2284-idle-cleaner-generation-race
Aug 2, 2026
Merged

Claim exact idle generation before closing pooled channels#2298
hyperxpro merged 1 commit into
mainfrom
fix/2284-idle-cleaner-generation-race

Conversation

Copy link
Copy Markdown
Member

Motivation:

The idle cleaner read a channel's idle timestamp after deciding it had expired, so a lease and re-offer in that window closed a healthy keep-alive on a stale verdict (#2284). Hoisting that read alone leaves a second race: claim and validation stay two steps, so the cleaner can briefly own a generation it never evaluated while a racing poll drops the channel from the pool entirely.

Modification:

IdleState packs ownership, a transfer-in-progress flag and a generation counter into one atomic word, and the cleaner claims with a single CAS against the exact generation its verdict came from.
offer() now transfers ownership rather than stamping unconditionally, and flushPartitions claimsbefore closing so it never closes a channel another caller owns.

Result:
Fixes #2284

hyperxpro merged commit bfc4db0 into main Aug 2, 2026
17 checks passed
hyperxpro deleted the fix/2284-idle-cleaner-generation-race branch August 2, 2026 07:00
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DefaultChannelPool cleaner can close a freshly re-offered channel

1 participant


Back | FazBrowse Home | New Git URL