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

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 13357980909269022d07a72efdaacc5308d5e450
Author: AurĂ©lien Pupier <[email protected]>
AuthorDate: Tue Nov 24 15:22:40 2026 +0100

    CAMEL-27278: camel-mina-sftp, camel-ftp - give 
SftpSimpleConsumeNoStartingDirIT more time for the first SSH connection
    
    SftpSimpleConsumeNoStartingDirIT is flaky since the build runs with -T1C:
    MockEndpoint.assertIsSatisfied(context) gives up after its default 10
    seconds with "Expected: <1> but was: <0>".
    
    Evidence gathered from the failing Jenkins -T1C build (#2537), using its
    camel-mina-sftp-test.log (the test of that failed run uses port 32843):
    - The consumer does not hang on one step, every step of the first connection
      is slow because many IT classes of the module run in the same JVM at the
      same time. Seconds after the route start, 11:34:34.7: first poll 35.4
      (initialDelay 1s), SSH connect 35.8 to 36.3, authentication 36.3 to 40.9
      (4.5s), SFTP channel and SSH_FXP_INIT 40.9 to 43.2, REALPATH 44.0, OPENDIR
      44.8, then the READDIR is still waiting when the 10s wait of the test
      expires and the context is shut down (the "Timeout expired while waiting
      for id=103" of the log is that shutdown). The first poll needs about 11s
      to 12s, no file is lost.
    - The whole module is slow in that build: its 30 single-test SFTP classes
      had a median of 9.9s and a maximum of 17.8s, against about 1.3s on an idle
      machine. The failing run lasted 11.97s, the rerun passed in 1.237s.
    - Injecting a delay of 12s into any phase of the first SSH session of an
      embedded server (accept, key exchange, authentication, SFTP init, first
      SFTP request, file read) gives the same failure with the 10s wait. With a
      30s wait the consumer always recovers: the connect times out after 10s and
      the next poll connects again, so the file is consumed in about 13s, and in
      about 25s when the first two connections stall.
    - Delays up to 8s pass with the current 10s wait.
    
    The wait is raised to 30 seconds in the camel-mina-sftp and in the camel-ftp
    copies of the test, about 2.5 times what the first poll took in the failing
    build. This is a mitigation, the load of the agent is not changed. The
    camel-ftp (JSch) copy has not been seen failing, it gets the same wait for
    consistency and its timing was not measured in detail.
    
    SftpSimpleProduceDisconnectIT, mentioned in the ticket, is not the same
    failure (Broken pipe after the server restart) and is addressed by
    CAMEL-27277.
    
    Co-authored-by: IBM Bob 2.2.1
    Signed-off-by: AurĂ©lien Pupier <[email protected]>
---
 .../remote/sftp/integration/SftpSimpleConsumeNoStartingDirIT.java    | 5 ++++-
 .../file/remote/mina/sftp/SftpSimpleConsumeNoStartingDirIT.java      | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpSimpleConsumeNoStartingDirIT.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpSimpleConsumeNoStartingDirIT.java
index c5213e0f9e22..ac4fbfdcecf4 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpSimpleConsumeNoStartingDirIT.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/integration/SftpSimpleConsumeNoStartingDirIT.java
@@ -18,6 +18,7 @@ package 
org.apache.camel.component.file.remote.sftp.integration;
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -42,7 +43,9 @@ public class SftpSimpleConsumeNoStartingDirIT extends 
SftpServerTestSupport {
 
             context.getRouteController().startRoute("foo");
 
-            MockEndpoint.assertIsSatisfied(context);
+            // a stall of the first SSH connection (connect timeout is 10s) is 
retried by the next poll,
+            // so it takes about 13s to consume and about 25s if two 
connections in a row stall
+            MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS);
         } finally {
             FileUtil.deleteFile(file);
             FileUtil.deleteFile(new File(".camel/a.txt"));
diff --git 
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleConsumeNoStartingDirIT.java
 
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleConsumeNoStartingDirIT.java
index dfd7189e2157..c38152515ab0 100644
--- 
a/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleConsumeNoStartingDirIT.java
+++ 
b/components/camel-mina-sftp/src/test/java/org/apache/camel/component/file/remote/mina/sftp/SftpSimpleConsumeNoStartingDirIT.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.file.remote.mina.sftp;
 
 import java.io.File;
 import java.io.FileOutputStream;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -42,7 +43,9 @@ public class SftpSimpleConsumeNoStartingDirIT extends 
SftpServerTestSupport {
 
             context.getRouteController().startRoute("foo");
 
-            MockEndpoint.assertIsSatisfied(context);
+            // a stall of the first SSH connection (connect timeout is 10s) is 
retried by the next poll,
+            // so it takes about 13s to consume and about 25s if two 
connections in a row stall
+            MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS);
         } finally {
             FileUtil.deleteFile(file);
             FileUtil.deleteFile(new File(".camel/a.txt"));

Reply via email to