This is an automated email from the ASF dual-hosted git repository.

MartijnVisser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new e91a0ce09e5 [FLINK-21995][yarn-tests] Whitelist netty-wrapped Pekko 
connection-refused WARN
e91a0ce09e5 is described below

commit e91a0ce09e5b944853bca713be2d445971112cb2
Author: Martijn Visser <[email protected]>
AuthorDate: Fri Jun 19 16:53:13 2026 +0200

    [FLINK-21995][yarn-tests] Whitelist netty-wrapped Pekko connection-refused 
WARN
    
    The checkForProhibitedLogContents check in YARNSessionFIFOSecuredITCase
    (and the other YARN session ITCases) flags any "Exception" substring in
    the TaskManager/JobManager logs. A benign WARN is emitted by Pekko during
    association teardown when a remote system is gated and the reconnect is
    refused. That line was already whitelisted, but the whitelist regex
    assumed the cause was a bare "java.net.ConnectException: Connection
    refused: <host>". Current Pekko/Netty wraps the cause in
    
"org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException",
    so the line no longer matches and the transient WARN trips the check,
    producing flaky failures such as testDetachedMode (see FLINK-26514).
    
    Extend the "Caused by:" portion of the existing pattern to accept both
    the old direct ConnectException form and the new Netty-wrapped
    AnnotatedConnectException form. The cause class is pinned to those two
    known types rather than matching any class that mentions "Connection
    refused", so an unrelated exception cannot slip through the whitelist.
    The rest of the pattern stays specific to the gated re-association WARN.
    
    This removes one source of false positives in the prohibited-log-contents
    check; it does not address every flaky cause tracked under FLINK-21995.
    
    YarnTestBaseTest gains a positive probe for the wrapped form and a
    negative probe asserting that a gated re-association WARN with a
    non-connection cause (still containing "Connection refused" text) is not
    whitelisted, guarding the discriminating property of the pattern.
    
    Generated-by: Claude Code (Opus 4.8)
---
 .../java/org/apache/flink/yarn/YarnTestBase.java   |  3 ++-
 .../org/apache/flink/yarn/YarnTestBaseTest.java    | 23 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git 
a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java 
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
index 45b5023abcd..a2621e090fe 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBase.java
@@ -152,8 +152,9 @@ public abstract class YarnTestBase {
         Pattern.compile(
                 "Remote connection to \\[.*\\] failed with 
java.nio.channels.NotYetConnectedException"),
         Pattern.compile("java\\.io\\.IOException: Connection reset by peer"),
+        // gated re-association WARN; the cause may now be Netty-wrapped
         Pattern.compile(
-                "Association with remote system \\[pekko.tcp://flink@[^]]+\\] 
has failed, address is now gated for \\[50\\] ms. Reason: \\[Association failed 
with \\[pekko.tcp://flink@[^]]+\\]\\] Caused by: \\[java.net.ConnectException: 
Connection refused: [^]]+\\]"),
+                "Association with remote system \\[pekko.tcp://flink@[^]]+\\] 
has failed, address is now gated for \\[50\\] ms. Reason: \\[Association failed 
with \\[pekko.tcp://flink@[^]]+\\]\\] Caused by: 
\\[(java\\.net\\.ConnectException|org\\.apache\\.flink\\.shaded\\.netty4\\.io\\.netty\\.channel\\.AbstractChannel\\$AnnotatedConnectException):
 Connection refused[^]]*\\]"),
 
         // filter out expected ResourceManagerException caused by intended 
shutdown request
         
Pattern.compile(YarnResourceManagerDriver.ERROR_MESSAGE_ON_SHUTDOWN_REQUEST),
diff --git 
a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBaseTest.java 
b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBaseTest.java
index 131dd44804f..eba2f3ca9cc 100644
--- a/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBaseTest.java
+++ b/flink-yarn-tests/src/test/java/org/apache/flink/yarn/YarnTestBaseTest.java
@@ -32,10 +32,20 @@ class YarnTestBaseTest {
         ensureWhitelistEntryMatch("465 java.lang.InterruptedException: sleep 
interrupted");
         ensureWhitelistEntryMatch(
                 "2020-09-19 22:06:19,458 WARN  
org.apache.pekko.remote.ReliableDeliverySupervisor                       [] - 
Association with remote system [pekko.tcp://flink@e466f3e261f3:42352] has 
failed, address is now gated for [50] ms. Reason: [Association failed with 
[pekko.tcp://flink@e466f3e261f3:42352]] Caused by: [java.net.ConnectException: 
Connection refused: e466f3e261f3/192.168.224.2:42352]");
+        ensureWhitelistEntryMatch(
+                "2026-06-18 05:08:21,447 WARN  
org.apache.pekko.remote.ReliableDeliverySupervisor           [] - Association 
with remote system [pekko.tcp://flink@14b2224d67fd:38335] has failed, address 
is now gated for [50] ms. Reason: [Association failed with 
[pekko.tcp://flink@14b2224d67fd:38335]] Caused by: 
[org.apache.flink.shaded.netty4.io.netty.channel.AbstractChannel$AnnotatedConnectException:
 Connection refused: 14b2224d67fd/172.21.0.2:38335, caused by: 
java.net.ConnectException [...]
         ensureWhitelistEntryMatch(
                 "2020-10-15 10:31:09,661 WARN  
org.apache.pekko.remote.transport.netty.NettyTransport                   [] - 
Remote connection to [61b81e62b514/192.168.128.2:39365] failed with 
java.io.IOException: Broken pipe");
     }
 
+    @Test
+    void ensureGatedReassociationWithNonConnectionCauseIsNotWhitelisted() {
+        ensureWhitelistEntryDoesNotMatch(
+                "2026-06-18 05:08:21,447 WARN  
org.apache.pekko.remote.ReliableDeliverySupervisor           [] - Association 
with remote system [pekko.tcp://flink@14b2224d67fd:38335] has failed, address 
is now gated for [50] ms. Reason: [Association failed with 
[pekko.tcp://flink@14b2224d67fd:38335]] Caused by: 
[java.lang.IllegalStateException: something unrelated]");
+        ensureWhitelistEntryDoesNotMatch(
+                "2026-06-18 05:08:21,447 WARN  
org.apache.pekko.remote.ReliableDeliverySupervisor           [] - Association 
with remote system [pekko.tcp://flink@14b2224d67fd:38335] has failed, address 
is now gated for [50] ms. Reason: [Association failed with 
[pekko.tcp://flink@14b2224d67fd:38335]] Caused by: 
[java.lang.NullPointerException: Connection refused: 
14b2224d67fd/172.21.0.2:38335]");
+    }
+
     private void ensureWhitelistEntryMatch(String probe) {
         for (Pattern pattern : YarnTestBase.WHITELISTED_STRINGS) {
             if (pattern.matcher(probe).find()) {
@@ -44,4 +54,17 @@ class YarnTestBaseTest {
         }
         fail("The following string didn't match any whitelisted patterns '" + 
probe + "'");
     }
+
+    private void ensureWhitelistEntryDoesNotMatch(String probe) {
+        for (Pattern pattern : YarnTestBase.WHITELISTED_STRINGS) {
+            if (pattern.matcher(probe).find()) {
+                fail(
+                        "The following string unexpectedly matched whitelisted 
pattern '"
+                                + pattern
+                                + "': '"
+                                + probe
+                                + "'");
+            }
+        }
+    }
 }

Reply via email to