Repository navigation
Release channel when FixedChannelPool acquire is cancelled - #17287
Conversation
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryBuild PR / linux-x86_64-java11-awslc build > Netty/Codec/HTTP2
Build PR / macos-aarch64-java11-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: 76fae38 Test FailuresKQueueDatagramUnicastIPv6MappedTest > testSimpleSendCompositeDirectByteBuf(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-aarch64-java11-boringssl build)Muted TestsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 Http2ConnectionRoundtripTest > createStreamAfterReceiveGoAwayShouldNotSendGoAway() 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. |
|
Could not create auto-port PR. |
|
Port for 5.0 #17288 |
|
Could not create auto-port PR. |
|
Need #17289 to make it easier to backport change to 4.1 |
|
Pr for 4:1 #17291 |
…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]>
…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]>
…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.
…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]>
…) (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]>
…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]>
Motivation:
FixedChannelPoolincrementsacquiredChannelCountbefore its internal acquire completes. If the caller cancels the original promise and the internal acquire succeeds,setSuccessthrows 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
trySuccessand 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)