mbalassi commented on code in PR #23183:
URL: https://github.com/apache/flink/pull/23183#discussion_r1306538023
##########
flink-core/src/main/java/org/apache/flink/util/NetUtils.java:
##########
@@ -431,6 +431,13 @@ public static Iterator<Integer>
getPortRangeFromString(String rangeDefinition)
+ end
+ ".");
}
+ if (start >= end) {
+ throw new IllegalConfigurationException(
+ "Invalid port configuration."
+ + " Port range end must be bigger than
port range start."
+ + " Given range: "
+ + range);
Review Comment:
nit: Since we are not allowing the edge case of `start = end` (which I agree
with), it might make sense to add the append the following to the error:
"If you wish to use single port please provide the value directly (not as a
range)."
It is debatable whether this is an improvement, please take it as just a
suggestion.
##########
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:
Can we be more specific than just `Exception` here?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]