Class NettyHttp2SelectorTest
NetworkClient.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidvoidvoidMake sure that the stream is closed when the connection times out and there is no pending request.voidMake sure that receiving data resets the idle timer, preventing premature closure.voidMake sure that the stream is gracefully closed when the connection times out and there is a pending request.voidVerify that idle connections are closed after the idle timeout, even when multiple connections are active and were established at different times.voidVerify that idle reverse streams are closed after the idle timeout, similar to regular connections.voidvoidIntegration-level reproduction of INC-11165 at the NetworkClient <-> NettyHttp2Selector boundary.voidWhen the queue is empty the blockingpollTasks.poll(timeout)returns null on idle timeout.voidA poll task that throws must not propagate out ofNettyHttp2Selector.poll(long).voidA swallowed poll-task exception is surfaced via thepoll-task-errormeter so the otherwise-silent failure is observable.voidA single throwing poll task must not abort the remaining drained tasks.voidvoidMethods inherited from class NettyClientTestBase
acceptAllSslContext, createStreamRequest, createStreamRequest, serverAddress
-
Constructor Details
-
NettyHttp2SelectorTest
public NettyHttp2SelectorTest()
-
-
Method Details
-
setupNetClient
@BeforeEach public void setupNetClient() -
closeResources
@AfterEach public void closeResources() -
testApiVersionsRequest
- Throws:
InterruptedException
-
testConnectMultipleTimes
- Throws:
InterruptedException
-
testPollDoesNotThrowWhenCompletedSendArrivesAfterClose
@Test public void testPollDoesNotThrowWhenCompletedSendArrivesAfterClose() throws InterruptedExceptionIntegration-level reproduction of INC-11165 at the NetworkClient <-> NettyHttp2Selector boundary.A send completes on the netty event loop and schedules its completed-send notification onto the poll thread. The connection is then closed before that notification is drained (as a reversed cluster-link connection is when the source resets it), which clears NetworkClient's in-flight request for the node. Draining the stale notification must NOT make NetworkClient.handleCompletedSends peek a non-existent in-flight request and throw IllegalStateException("There are no in-flight requests for node ...") — the exception that, in INC-11165, escaped ClusterLinkSharedFetcherThread.doWork and deadlocked the broker.
The cluster-link reverse path runs the same StreamChannel code via ReversableSelector; a forward connection is used here so the flow can be driven deterministically through a real NetworkClient. Regression test for KGLOBAL-9674.
- Throws:
InterruptedException
-
testReverseStreamIsReplaced
- Throws:
IOException
-
testClosingReversedStreams
- Throws:
IOException
-
testWakeupMarkerPreventsBlocking
- Throws:
InterruptedException
-
testPollBlocksWithoutWakeupMarkerWhenNoWork
- Throws:
InterruptedException
-
testPollSwallowsExceptionFromPollTask
@Test public void testPollSwallowsExceptionFromPollTask()A poll task that throws must not propagate out ofNettyHttp2Selector.poll(long). Previously the whole poll-task loop was wrapped in a single try/catch that rethrew any RuntimeException, which could tear down the proxy poll thread. The fix runs each task in its own try/catch that logs and swallows the exception, matching the standard KafkaSelector, which never surfaces per-channel failures out of poll(). -
testPollTaskFailureDoesNotAbortRemainingTasks
@Test public void testPollTaskFailureDoesNotAbortRemainingTasks()A single throwing poll task must not abort the remaining drained tasks. The previoustasks.forEach(Runnable::run)aborted the whole batch on the first throw; the fix isolates each task so the ones queued before and after the failing one still run. -
testPollHandlesNullTaskOnIdleTimeout
@Test public void testPollHandlesNullTaskOnIdleTimeout()When the queue is empty the blockingpollTasks.poll(timeout)returns null on idle timeout. The null guard in runPollTask preserves the priorif (op != null)semantics: poll() must return cleanly without dereferencing the null task. -
testPollTaskErrorIsMetered
@Test public void testPollTaskErrorIsMetered()A swallowed poll-task exception is surfaced via thepoll-task-errormeter so the otherwise-silent failure is observable. ComplementstestPollSwallowsExceptionFromPollTask(), which asserts the exception does not propagate. -
testIdleTimeoutNoActiveRequest
-
testIdleTimeoutWithActiveRequest
-
testIdleTimeoutResetOnActivity
-
testIdleWithMultipleConnections
-
testIdleWithMultipleReverseStreams
-