You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/10/21 13:16:56 UTC

[GitHub] [flink] AHeise commented on a change in pull request #13723: [FlINK-19688][network] Don't cache InterruptedExceptions in PartitionRequestClientFactory

AHeise commented on a change in pull request #13723:
URL: https://github.com/apache/flink/pull/13723#discussion_r509264809



##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactoryTest.java
##########
@@ -58,6 +59,38 @@
 
 	private static final int SERVER_PORT = NetUtils.getAvailablePort();
 
+	@Test
+	public void testInterruptsNotCached() throws Exception {
+		ConnectionID connectionId = new ConnectionID(new InetSocketAddress(InetAddress.getLocalHost(), 8080), 0);

Review comment:
       Sorry for the stupid question, but is this actually using the port for network traffic or is it just a dummy value?
   If it's actually using, I'd propose to use port 0 (random free port).

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/io/network/netty/NeverCompletingChannelFuture.java
##########
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.io.network.netty;
+
+import org.apache.flink.shaded.netty4.io.netty.channel.Channel;
+import org.apache.flink.shaded.netty4.io.netty.channel.ChannelFuture;
+import org.apache.flink.shaded.netty4.io.netty.util.concurrent.Future;
+import org.apache.flink.shaded.netty4.io.netty.util.concurrent.GenericFutureListener;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+@SuppressWarnings({"InfiniteLoopStatement", "BusyWait"})
+class NeverCompletingChannelFuture implements ChannelFuture {

Review comment:
       Could we use `CompleteChannelFuture` as a base to avoid all the no-ops?

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestClientFactory.java
##########
@@ -75,12 +73,24 @@ NettyPartitionRequestClient createPartitionRequestClient(ConnectionID connection
 				return new CompletableFuture<>();
 			});
 			if (isTheFirstOne.get()) {
-				completeFromCallable(clientFuture, () -> connectWithRetries(connectionId));
+				try {
+					clientFuture.complete(connectWithRetries(connectionId));
+				} catch (InterruptedException e) {
+					clientFuture.complete(null); // let know others waiting that they should retry

Review comment:
       nit: let others know




----------------------------------------------------------------
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.

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