You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "showuon (via GitHub)" <gi...@apache.org> on 2023/09/01 12:11:14 UTC

[GitHub] [kafka] showuon opened a new pull request, #14320: KAFKA-15421: fix network thread leak

showuon opened a new pull request, #14320:
URL: https://github.com/apache/kafka/pull/14320

   In `SocketServerTest`, we create `SocketServer` and `enableRequestProcessing` on each test class initialization. That's fine since we shutdown it in `@AfterEach`. The issue we have is we disabled 2 tests in this test suite. And when running these disabled tests, we will go through class initialization, but without `@AfterEach`. That causes 2 network thread leaked. 
   
   Compared the error message [here](https://ci-builds.apache.org/job/Kafka/job/kafka/job/trunk/2150/testReport/junit/kafka.server/DynamicBrokerReconfigurationTest/Build___JDK_20_and_Scala_2_13___testThreadPoolResize__/):
   
   ```
   org.opentest4j.AssertionFailedError: Invalid threads: expected 6, got 8: List(data-plane-kafka-socket-acceptor-ListenerName(INTERNAL)-SSL-0, data-plane-kafka-socket-acceptor-ListenerName(PLAINTEXT)-PLAINTEXT-0, data-plane-kafka-socket-acceptor-ListenerName(INTERNAL)-SSL-0, data-plane-kafka-socket-acceptor-ListenerName(EXTERNAL)-SASL_SSL-0, data-plane-kafka-socket-acceptor-ListenerName(INTERNAL)-SSL-0, data-plane-kafka-socket-acceptor-ListenerName(EXTERNAL)-SASL_SSL-0, data-plane-kafka-socket-acceptor-ListenerName(PLAINTEXT)-PLAINTEXT-0, data-plane-kafka-socket-acceptor-ListenerName(EXTERNAL)-SASL_SSL-0) ==> expected: <true> but was: <false>
   ```
   
   The 2 unexpected network threads are leaked from `SocketServerTest`.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-15421: fix network thread leak in testThreadPoolResize [kafka]

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1939683100

   Hmm I see this flaking again -- https://ge.apache.org/scans/tests?search.names=Git%20branch&search.relativeStartTime=P28D&search.rootProjectNames=kafka&search.timeZoneId=America%2FLos_Angeles&search.values=trunk&tests.container=kafka.server.DynamicBrokerReconfigurationTest&tests.test=testThreadPoolResize()
   
   Any ideas?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-15421: fix network thread leak in testThreadPoolResize [kafka]

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1941279651

   @jolshan , I think this has been fixed thanks to @nizhikov in this PR: https://github.com/apache/kafka/pull/15256
   
   latest trunk build: https://ci-builds.apache.org/job/Kafka/job/kafka/job/trunk/2640/


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on a diff in pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on code in PR #14320:
URL: https://github.com/apache/kafka/pull/14320#discussion_r1312952812


##########
core/src/test/scala/unit/kafka/network/SocketServerTest.scala:
##########
@@ -94,6 +93,7 @@ class SocketServerTest {
 
   @BeforeEach
   def setUp(): Unit = {
+    server.enableRequestProcessing(Map.empty).get(1, TimeUnit.MINUTES)

Review Comment:
   `enableRequestProcessing` will start network thread to accept connection. Start it in `BeforeEach`, so that it won't be initialized unexpectedly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] divijvaidya commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1703186896

   cc: @C0urante @jolshan since you folks were wondering about the mystery of threads leaks as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] jolshan commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "jolshan (via GitHub)" <gi...@apache.org>.
jolshan commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1703274740

   For my understanding, the issue was from tests disabled previously (ie, not the 2 we just disabled?)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1704046955

   > For my understanding, the issue was from tests disabled previously (ie, not the 2 we just disabled?) And if so can we re-enable the 2 we just disabled while investigating?
   
   Yes, the issue was from tests disabled previously, not the 2 (i.e.  [KAFKA-15421](https://issues.apache.org/jira/browse/KAFKA-15421) and [KAFKA-15399](https://issues.apache.org/jira/browse/KAFKA-15399) ) we disabled.
   
   > That way we can close [KAFKA-15421](https://issues.apache.org/jira/browse/KAFKA-15421) and [KAFKA-15399](https://issues.apache.org/jira/browse/KAFKA-15399)
   
   To be clear, the PR is to address [KAFKA-15421](https://issues.apache.org/jira/browse/KAFKA-15421) only. For [KAFKA-15399](https://issues.apache.org/jira/browse/KAFKA-15399), it is addressed in https://github.com/apache/kafka/pull/14319 . Anyway, there are all fixed now. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon merged pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon merged PR #14320:
URL: https://github.com/apache/kafka/pull/14320


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1704045909

   Backported into 3.6 branch.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1702654646

   @clolov @divijvaidya @satishd @kamalcph , call for review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1704047268

   > Did you find something that we can do in our test framework that can help us investigate such leaks quickly?
   
   Yes, there should be something we can do to improve it. Let me think about it.
   
   > We should also enable testThreadPoolResize which was disabled in https://github.com/apache/kafka/commit/43fe13350f7a4c74cd101cbb69a01d062f5c9329
   > Do you want to do that in this same PR itself or different?
   
   Thanks for the reminder. Re-enabled them and confirmed no failed tests related to thread leaks now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] divijvaidya commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "divijvaidya (via GitHub)" <gi...@apache.org>.
divijvaidya commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1703171354

   We should also enable `testThreadPoolResize` which was disabled in https://github.com/apache/kafka/commit/43fe13350f7a4c74cd101cbb69a01d062f5c9329 
   
   Do you want to do that in this same PR itself or different?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] showuon commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "showuon (via GitHub)" <gi...@apache.org>.
showuon commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1704045285

   Failed tests are unrelated:
   ```
       Build / JDK 20 and Scala 2.13 / integration.kafka.server.FetchFromFollowerIntegrationTest.testFollowerCompleteDelayedFetchesOnReplication(String).quorum=kraft
       Build / JDK 11 and Scala 2.13 / kafka.admin.TopicCommandIntegrationTest.testDescribeUnderMinIsrPartitionsMixed(String).quorum=zk
       Build / JDK 20 and Scala 2.13 / kafka.api.TransactionsTest.testBumpTransactionalEpoch(String).quorum=kraft
       Build / JDK 17 and Scala 2.13 / org.apache.kafka.controller.QuorumControllerMetricsIntegrationTest.testClosingQuorumControllerClosesMetrics()
       Build / JDK 8 and Scala 2.12 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()
       Build / JDK 8 and Scala 2.12 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()
       Build / JDK 11 and Scala 2.13 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()
       Build / JDK 20 and Scala 2.13 / org.apache.kafka.controller.QuorumControllerTest.testBalancePartitionLeaders()
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [kafka] C0urante commented on pull request #14320: KAFKA-15421: fix network thread leak in testThreadPoolResize

Posted by "C0urante (via GitHub)" <gi...@apache.org>.
C0urante commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1703531194

   @showuon you're my hero, thanks for your diligent work on fixing these flaky tests!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] KAFKA-15421: fix network thread leak in testThreadPoolResize [kafka]

Posted by "nizhikov (via GitHub)" <gi...@apache.org>.
nizhikov commented on PR #14320:
URL: https://github.com/apache/kafka/pull/14320#issuecomment-1941286538

   Hello @showuon 
   
   I struggle with `SslAdminIntegrationTest` failures.
   This test count socket threads and fails on unexpected count:
   
   I fixed `DeleteTopicTest` that don't invoke `shutdown` for kraft resources when overwrites them. 
   
   Not sure if `DeleteTopicTest` fix are fixing these tests, also.
   
   ```
     private def blockedRequestThreads: List[Thread] = {
       val requestThreads = Thread.getAllStackTraces.keySet.asScala
         .filter(_.getName.contains("data-plane-kafka-request-handler"))
       assertEquals(numRequestThreads, requestThreads.size)
       requestThreads.filter(_.getState == Thread.State.WAITING).toList
     }
   
     private def numRequestThreads = servers.head.config.numIoThreads * servers.size
   
     private def waitForNoBlockedRequestThreads(): Unit = {
       val (blockedThreads, _) = TestUtils.computeUntilTrue(blockedRequestThreads)(_.isEmpty)
       assertEquals(List.empty, blockedThreads)
     }
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org