You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Arvid Heise (Jira)" <ji...@apache.org> on 2021/11/12 15:16:00 UTC
[jira] [Commented] (FLINK-24821)
FlinkKafkaProducerMigrationOperatorTest.testRestoreProducer fails on AZP
[ https://issues.apache.org/jira/browse/FLINK-24821?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17442802#comment-17442802 ]
Arvid Heise commented on FLINK-24821:
-------------------------------------
This seems to be caused by the use of [NetUtils#getAvailablePort|https://github.com/apache/flink/blob/master/flink-core/src/main/java/org/apache/flink/util/NetUtils.java#L161-L161].
{noformat}
public static int getAvailablePort() {
for (int i = 0; i < 50; i++) {
try (ServerSocket serverSocket = new ServerSocket(0)) {
int port = serverSocket.getLocalPort();
if (port != 0) {
return port;
}
} catch (IOException ignored) {
}
}
throw new RuntimeException("Could not find a free permitted port on the machine.");
}
{noformat}
There are a couple of places that use it, in particular all legacy Kafka tests, and it seems to be a larger effort to replace it. I see 3 options:
- Leave as is and live with sporadic issues. This test has been in the codebase since ages and it didn't pop up so far(?).
- Repeat the test X times in case of failures. It would be nice if we could only repeat the test on BindException.
- Remove legacy Kafka tests (note that quite a few Netty and Task threads also use the same flawed way to acquire a port).
> FlinkKafkaProducerMigrationOperatorTest.testRestoreProducer fails on AZP
> ------------------------------------------------------------------------
>
> Key: FLINK-24821
> URL: https://issues.apache.org/jira/browse/FLINK-24821
> Project: Flink
> Issue Type: Bug
> Components: Connectors / Kafka
> Affects Versions: 1.14.0, 1.15.0
> Reporter: Till Rohrmann
> Priority: Critical
> Labels: test-stability
> Fix For: 1.15.0, 1.14.1
>
>
> The test {{FlinkKafkaProducerMigrationOperatorTest.testRestoreProducer}} fails on AZP with
> {code}
> Nov 07 23:02:14 [ERROR] testRestoreProducer[Migration Savepoint: 1.8] Time elapsed: 2.008 s <<< ERROR!
> Nov 07 23:02:14 java.net.BindException: Address already in use
> Nov 07 23:02:14 at sun.nio.ch.Net.bind0(Native Method)
> Nov 07 23:02:14 at sun.nio.ch.Net.bind(Net.java:461)
> Nov 07 23:02:14 at sun.nio.ch.Net.bind(Net.java:453)
> Nov 07 23:02:14 at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:222)
> Nov 07 23:02:14 at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85)
> Nov 07 23:02:14 at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:78)
> Nov 07 23:02:14 at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:90)
> Nov 07 23:02:14 at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:120)
> Nov 07 23:02:14 at org.apache.curator.test.TestingZooKeeperMain.runFromConfig(TestingZooKeeperMain.java:93)
> Nov 07 23:02:14 at org.apache.curator.test.TestingZooKeeperServer$1.run(TestingZooKeeperServer.java:148)
> Nov 07 23:02:14 at java.lang.Thread.run(Thread.java:748)
> {code}
> https://dev.azure.com/apache-flink/apache-flink/_build/results?buildId=26096&view=logs&j=72d4811f-9f0d-5fd0-014a-0bc26b72b642&t=e424005a-b16e-540f-196d-da062cc19bdf&l=7302
> It looks that there is a race condition for avaiable ports.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)