GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Release channel when FixedChannelPool acquire is cancelled by Gimini-3 · Pull Request #17287 · netty/netty

Conversation

@Gimini-3

@Gimini-3 Gimini-3 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Motivation:

FixedChannelPool increments acquiredChannelCount before its internal acquire completes. If the caller cancels the original promise and the internal acquire succeeds, setSuccess throws and the acquired channel is neither returned nor closed. The slot remains occupied, pending acquires may stall, and pool close cannot reach the undelivered channel.

Modification:

Complete the caller promise with trySuccess and release the channel when the promise was already completed. Add deterministic coverage for cancellation before delivery, cancelled pending acquires, queue progression, slot accounting, and pool-close races.

Result:

Cancelled acquires no longer leak a channel or an acquired slot, and pending acquires continue once the undelivered channel is returned.

Fixes #9669.

Validation:

  • ./mvnw -pl transport -Dtest=FixedChannelPoolTest test
  • ./mvnw -pl transport test (394 tests, 0 failures, 0 errors, 9 skipped)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Gimini-3
Release channel when FixedChannelPool acquire is cancelled
76fae38
@Gimini-3
Gimini-3 marked this pull request as ready for review August 14, 2026 07:54
@testlens-app

testlens-app Bot commented Aug 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Build PR / linux-x86_64-java11-awslc build > Netty/Codec/HTTP2

Test Runs Flakiness
Http2ConnectionRoundtripTest > createStreamAfterReceiveGoAwayShouldNotSendGoAway() ❌ ✅ 1% 🟡

Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) ✅ ❌ 5% 🟠
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo) ❌ ✅ 1% 🟡

🏷️ Commit: 76fae38
▶️ Tests: 43220 executed
🟡 Checks: 22/24 completed

Test Failures

KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:360)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:192)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:121)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:112)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$3.run(DatagramUnicastTest.java:109)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendCompositeDirectByteBuf(DatagramUnicastTest.java:109)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

Muted Tests

Note

Checks are currently running using the configuration below.

Select tests to mute in this pull request:

🔲 Http2ConnectionRoundtripTest > createStreamAfterReceiveGoAwayShouldNotSendGoAway()
🔲 KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo)
🔲 KQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeHeapByteBuf(TestInfo)

Reuse successful test results:

🔲 ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

☑️ Rerun jobs


Learn more about TestLens at testlens.app.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer added this to the 4.2.18.Final milestone Aug 14, 2026
@normanmaurer normanmaurer added needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Aug 14, 2026
@normanmaurer
normanmaurer merged commit 21dd89e into netty:4.2 Aug 14, 2026
36 of 39 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 5.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Aug 14, 2026

Copy link
Copy Markdown
Member

Port for 5.0 #17288

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@netty-project-bot

netty-project-bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Could not create auto-port PR.
Got conflicts when cherry-picking onto 4.1.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Aug 14, 2026

Copy link
Copy Markdown
Member

Need #17289 to make it easier to backport change to 4.1

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer

normanmaurer commented Aug 14, 2026

Copy link
Copy Markdown
Member

Pr for 4:1 #17291

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

normanmaurer added a commit that referenced this pull request Aug 15, 2026
@normanmaurer @Gimini-3
Release channel when FixedChannelPool acquire is cancelled (#17287) (#…
0f09e56
…17288)

Motivation:

`FixedChannelPool` increments `acquiredChannelCount` before its internal
acquire completes. If the caller cancels the original promise and the
internal acquire succeeds, `setSuccess` throws and the acquired channel
is neither returned nor closed. The slot remains occupied, pending
acquires may stall, and pool close cannot reach the undelivered channel.

Modification:

Complete the caller promise with `trySuccess` and release the channel
when the promise was already completed. Add deterministic coverage for
cancellation before delivery, cancelled pending acquires, queue
progression, slot accounting, and pool-close races.

Result:

Cancelled acquires no longer leak a channel or an acquired slot, and
pending acquires continue once the undelivered channel is returned.

Fixes #9669.

Validation:

- `./mvnw -pl transport -Dtest=FixedChannelPoolTest test`
- `./mvnw -pl transport test` (394 tests, 0 failures, 0 errors, 9
skipped)

---------

Co-authored-by: Gimin Kim <[email protected]>
normanmaurer added a commit that referenced this pull request Aug 16, 2026
@normanmaurer @Gimini-3
Release channel when FixedChannelPool acquire is cancelled (#17287) (#…
e11f66c
…17291)

Motivation:

`FixedChannelPool` increments `acquiredChannelCount` before its internal
acquire completes. If the caller cancels the original promise and the
internal acquire succeeds, `setSuccess` throws and the acquired channel
is neither returned nor closed. The slot remains occupied, pending
acquires may stall, and pool close cannot reach the undelivered channel.

Modification:

Complete the caller promise with `trySuccess` and release the channel
when the promise was already completed. Add deterministic coverage for
cancellation before delivery, cancelled pending acquires, queue
progression, slot accounting, and pool-close races.

Result:

Cancelled acquires no longer leak a channel or an acquired slot, and
pending acquires continue once the undelivered channel is returned.

Fixes #9669.

Validation:

- `./mvnw -pl transport -Dtest=FixedChannelPoolTest test`
- `./mvnw -pl transport test` (394 tests, 0 failures, 0 errors, 9
skipped)

---------

Co-authored-by: Gimin Kim <[email protected]>
@lhotari lhotari mentioned this pull request Sep 10, 2026
[fix][sec] Upgrade Netty to 4.2.18 to address several CVEs and bugs apache/pulsar#26514
Merged
2 of 11 tasks
@renechoi renechoi mentioned this pull request Sep 21, 2026
POOL: Release Channel when SimpleChannelPool acquire is cancelled #17569
Merged
normanmaurer pushed a commit that referenced this pull request Sep 21, 2026
@renechoi
POOL: Release Channel when SimpleChannelPool acquire is cancelled (#1…
6b257ce
…7569)

### Motivation

`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(...)`.

#17287 gave `FixedChannelPool` this guard.

### Modification

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

### Result

Reverting just the source hunk fails that test on `releasedCount()`, 2
expected, 1 seen. With it, 34/34.
@netty-project-bot netty-project-bot mentioned this pull request Sep 21, 2026
Auto-port 4.1: POOL: Release Channel when SimpleChannelPool acquire is cancelled #17578
Merged
normanmaurer added a commit that referenced this pull request Sep 22, 2026
@netty-project-bot @renechoi @normanmaurer
Auto-port 4.1: POOL: Release Channel when SimpleChannelPool acquire i…
ec1de88
…s cancelled (#17578)

Auto-port of #17569 to 4.1
Cherry-picked commit: 6b257ce

---
### Motivation

`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(...)`.

#17287 gave `FixedChannelPool` this guard.

### Modification

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

### Result

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

---------

Co-authored-by: renechoi <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
@normanmaurer normanmaurer mentioned this pull request Oct 1, 2026
child5 #17695
Closed
@normanmaurer normanmaurer removed needs-cherry-pick-4.1 This PR should be cherry-picked to 4.1 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Oct 16, 2026
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@normanmaurer @Gimini-3 @lltopk
Release channel when FixedChannelPool acquire is cancelled (netty#17287…
a83d62f
…) (netty#17291)

Motivation:

`FixedChannelPool` increments `acquiredChannelCount` before its internal
acquire completes. If the caller cancels the original promise and the
internal acquire succeeds, `setSuccess` throws and the acquired channel
is neither returned nor closed. The slot remains occupied, pending
acquires may stall, and pool close cannot reach the undelivered channel.

Modification:

Complete the caller promise with `trySuccess` and release the channel
when the promise was already completed. Add deterministic coverage for
cancellation before delivery, cancelled pending acquires, queue
progression, slot accounting, and pool-close races.

Result:

Cancelled acquires no longer leak a channel or an acquired slot, and
pending acquires continue once the undelivered channel is returned.

Fixes netty#9669.

Validation:

- `./mvnw -pl transport -Dtest=FixedChannelPoolTest test`
- `./mvnw -pl transport test` (394 tests, 0 failures, 0 errors, 9
skipped)

---------

Co-authored-by: Gimin Kim <[email protected]>
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
@netty-project-bot @renechoi
@normanmaurer @lltopk
Auto-port 4.1: POOL: Release Channel when SimpleChannelPool acquire i…
a8491fe
…s cancelled (netty#17578)

Auto-port of netty#17569 to 4.1
Cherry-picked commit: 6b257ce

---
### Motivation

`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(...)`.

netty#17287 gave `FixedChannelPool` this guard.

### Modification

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

### Result

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

---------

Co-authored-by: renechoi <[email protected]>
Co-authored-by: Norman Maurer <[email protected]>
@normanmaurer normanmaurer mentioned this pull request Oct 26, 2026
crisp nova cceda091 #18109
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.2.18.Final

Development

Successfully merging this pull request may close these issues.

IllegalStateException: complete already on notifyListener / operationComplete

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Gimini-3 @netty-project-bot @normanmaurer
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.