This is an automated email from the ASF dual-hosted git repository.
chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git
The following commit(s) were added to refs/heads/trunk by this push:
new 736bd3cd093 KAFKA-17201
SelectorTest.testInboundConnectionsCountInConnectionCreationMetric leaks
sockets and threads (#16723)
736bd3cd093 is described below
commit 736bd3cd093cd418b4fec5b583359884f23265ff
Author: TengYao Chi <[email protected]>
AuthorDate: Mon Aug 5 22:47:06 2024 +0800
KAFKA-17201
SelectorTest.testInboundConnectionsCountInConnectionCreationMetric leaks
sockets and threads (#16723)
Reviewers: Chia-Ping Tsai <[email protected]>
---
.../java/org/apache/kafka/common/network/SelectorTest.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git
a/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
b/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
index 782c429e917..15a38b172bd 100644
--- a/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
+++ b/clients/src/test/java/org/apache/kafka/common/network/SelectorTest.java
@@ -831,10 +831,12 @@ public class SelectorTest {
for (int i = 0; i < conns; i++) {
Thread sender = createSender(serverAddress, randomPayload(1));
sender.start();
- SocketChannel channel = ss.accept();
- channel.configureBlocking(false);
-
- selector.register(Integer.toString(i), channel);
+ try (SocketChannel channel = ss.accept()) {
+ channel.configureBlocking(false);
+ selector.register(Integer.toString(i), channel);
+ } finally {
+ sender.join();
+ }
}
}