ferenc-csaky commented on code in PR #23183: URL: https://github.com/apache/flink/pull/23183#discussion_r1306611189
########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyServer.java: ########## @@ -145,7 +144,35 @@ int init( // Start Server // -------------------------------------------------------------------- - bindFuture = bootstrap.bind().syncUninterruptibly(); + LOG.debug( + "Trying to initialize Netty server on address: {} and port range {}", + config.getServerAddress(), + config.getServerPortRange()); + + Iterator<Integer> portsIterator = config.getServerPortRange().getPortsIterator(); + while (portsIterator.hasNext() && bindFuture == null) { + Integer port = portsIterator.next(); + LOG.debug("Trying to bind Netty server to port: {}", port); + + bootstrap.localAddress(config.getServerAddress(), port); + try { + bindFuture = bootstrap.bind().syncUninterruptibly(); + } catch (Exception e) { Review Comment: Probably yes, but Netty wraps and throws any kind of exception via `FailedChannelFuture`, which is not specified really well, so not without a lot more digging. Furthermore I copied this "pattern" from the codebase, so I considered it good enough: https://github.com/apache/flink/blob/42f170b192049bc573efddd3f82169bb327b3fe4/flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java#L275 -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org