Skip to content

Port: POOL: Release Channel when SimpleChannelPool acquire is cancelled (#17569) - #17580

Merged
normanmaurer merged 1 commit into
5.0from
pool5
Sep 21, 2026
Merged

normanmaurer merged 1 commit into
5.0from
pool5

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

notifyConnect() completes the acquire Promise with trySuccess(...)
and releases the Channel if already completed. notifyHealthCheck(),
the reuse path, still uses setSuccess(...).

doHealthCheck runs via loop.execute(...) when acquire() is called
off its event loop, so a cancel can land while that task is queued, even
with the stock ACTIVE checker. setSuccess(...) then throws into
closeAndFail(...): a healthy pooled Channel is closed and its
channelAcquired(...) gets no channelReleased(...).

notifyHealthCheck() mirrors notifyConnect(), plus a regression test
on a hand-completed health check.

Reverting just the source hunk fails that test on releasedCount(), 2
expected, 1 seen. With it, 34/34.

…7569)

`notifyConnect()` completes the acquire `Promise` with `trySuccess(...)`
and releases the `Channel` if already completed. `notifyHealthCheck()`,
the reuse path, still uses `setSuccess(...)`.

`doHealthCheck` runs via `loop.execute(...)` when `acquire()` is called
off its event loop, so a cancel can land while that task is queued, even
with the stock `ACTIVE` checker. `setSuccess(...)` then throws into
`closeAndFail(...)`: a healthy pooled `Channel` is closed and its
`channelAcquired(...)` gets no `channelReleased(...)`.

`notifyHealthCheck()` mirrors `notifyConnect()`, plus a regression test
on a hand-completed health check.

Reverting just the source hunk fails that test on `releasedCount()`, 2
expected, 1 seen. With it, 34/34.
@normanmaurer normanmaurer changed the title POOL: Release Channel when SimpleChannelPool acquire is cancelled (#17569) Port: POOL: Release Channel when SimpleChannelPool acquire is cancelled (#17569) Sep 21, 2026
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Sep 21, 2026
@normanmaurer
normanmaurer enabled auto-merge (squash) September 21, 2026 18:58
@testlens-app

testlens-app Bot commented Sep 21, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: cc16769
▶️ Tests: 220253 executed
⚪️ Checks: 12/12 completed


Learn more about TestLens at testlens.app/docs.

@normanmaurer
normanmaurer merged commit f973c98 into 5.0 Sep 21, 2026
13 checks passed
@normanmaurer
normanmaurer deleted the pool5 branch September 21, 2026 23:12
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