Copilot commented on code in PR #7401: URL: https://github.com/apache/incubator-seata/pull/7401#discussion_r2119352298
########## core/src/test/java/org/apache/seata/core/rpc/netty/ChannelEventHandlerIntegrationTest.java: ########## @@ -279,4 +283,10 @@ private DefaultChannelGroup collectServerChannels(EventLoopGroup workerGroup) th } return channels; } + + private static int findAvailablePort() throws IOException { + try (ServerSocket socket = new ServerSocket(0)) { + return socket.getLocalPort(); + } Review Comment: Using findAvailablePort to obtain a free port may introduce a race condition if the port is claimed between its selection and subsequent binding. Consider holding the ServerSocket open until the test server binds to prevent potential conflicts. ```suggestion private static ServerSocket findAvailablePort() throws IOException { ServerSocket socket = new ServerSocket(0); socket.setReuseAddress(true); return socket; ``` -- 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: notifications-unsubscr...@seata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org