GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — POOL: Release Channel when SimpleChannelPool acquire is cancelled by renechoi · Pull Request #17569 · netty/netty Conversation
Contributor
Motivation
#17287 gave Modification
ResultReverting just the source hunk fails that test on
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsMotivation: SimpleChannelPool hands an acquired Channel to the caller's Promise in two places. notifyConnect() completes the Promise with trySuccess(...) and releases the Channel back into the pool when the Promise turns out to be completed already, which is what happens when the caller cancelled the acquire. notifyHealthCheck(), the path taken when an already pooled Channel is reused, still completes the Promise with setSuccess(...). So when the acquire Promise is completed while the health check of a pooled Channel is still pending, setSuccess(...) throws IllegalStateException. The surrounding catch routes it to closeAndFail(...), which closes a healthy pooled Channel instead of offering it back. handler.channelAcquired(...) has already been invoked at that point, so the matching channelReleased(...) callback never arrives and a ChannelPoolHandler that tracks acquire and release counts stays out of balance for the rest of the pool's lifetime. FixedChannelPool.AcquireListener already guards the same race the same way. Modifications: - Complete the acquire Promise in notifyHealthCheck() with trySuccess(...) and release the Channel again when it was completed already, mirroring what notifyConnect() does. - Add a regression test that cancels the acquire Promise while the health check of a pooled Channel is pending, and asserts that the Channel stays active, is handed back by the next acquire, and that the pool handler callbacks stay balanced. Result: Cancelling an acquire no longer destroys a pooled Channel, and the channelAcquired and channelReleased callbacks stay balanced.
|
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryBuild PR / macos-x86_64-java11-boringssl build > Netty/Transport/Native/KQueue
🏷️ Commit: f82323a Test FailuresKQueueJdkLoopbackSocketSslEchoTest > testSslEcho(SslContext, SslContext, Renegotiation, boolean, boolean, boolean, boolean, boolean, TestInfo) > 49: serverEngine = io.netty.handler.ssl.JdkSslServerContext@1c98b4eb, clientEngine = io.netty.handler.ssl.JdkSslClientContext@45801322, renegotiation = CLIENT_INITIATED(TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA), serverUsesDelegatedTaskExecutor = true, clientUsesDelegatedTaskExecutor = false, autoRead = false, useChunkedWriteHandler = false, useCompositeByteBuf = false (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java11-boringssl build)Rerun ControlsNote Checks are currently running using the configuration below. Select tests to mute in this pull request: 🔲 KQueueJdkLoopbackSocketSslEchoTest > testSslEcho(SslContext, SslContext, Renegotiation, boolean, boolean, boolean, boolean, boolean, 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/docs. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Auto-port PR for 4.1: #17578 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Could not create auto-port PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Port for 5.0: #17580 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ed (#17569) (#17580) `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. Co-authored-by: renechoi <[email protected]>
…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. (cherry picked from commit 6b257ce)
…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]>
…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]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.