gnodet opened a new pull request, #27498:
URL: https://github.com/apache/camel/pull/27498

   ## Summary
   
   Fix the flaky test 
`SshIdleTimeoutTest.testIdleTimeoutExpiresBeforeCommandCompletes` which has 
failed 2 times and been flaky 7 times in the last 90 days (see 
[Develocity](https://develocity.apache.org/scans/tests?search.relativeStartTime=P90D&search.rootProjectNames=camel&search.timeZoneId=Europe%2FParis&tests.container=org.apache.camel.component.ssh.SshIdleTimeoutTest&tests.test=testIdleTimeoutExpiresBeforeCommandCompletes)),
 with a much higher failure rate under parallel builds (`-T1C`).
   
   ## Root Cause
   
   The test had a 2:1 timing ratio between the server-side command delay 
(1000ms) and the client idle timeout (500ms). Apache MINA SSHD's idle timeout 
is **not a hard real-time timer** — it is checked periodically by the I/O event 
loop, and crucially the idle clock only starts **after the SSH handshake and 
channel open complete** (both of which reset the idle timer). Under CI load 
with scheduling jitter, the combined overhead can consume most of the 1000ms 
window, letting the command finish before the idle timeout fires.
   
   The failure mode:
   ```
   org.opentest4j.AssertionFailedError: Exit value should be null because the 
session was closed by idle timeout before the command completed ==> expected: 
<null> but was: <0>
   ```
   
   ## Fix
   
   Increase `DelayedEchoCommandFactory` command delay from **1000ms → 5000ms**, 
giving a **10:1 ratio** (5000ms delay vs 500ms idle timeout). This makes the 
race condition negligible even under heavy CI load. Also:
   
   - Update `sshWithShortIdleTimeout` route: `timeout=5000` → `timeout=10000` 
(must survive the 5s command delay)
   - Update `sshWithLongIdleTimeout` route: `idleTimeout=5000` → 
`idleTimeout=30000`, `timeout=5000` → `timeout=30000`
   - Fix stale comments that referenced "3s command delay"
   
   ## Testing
   
   All 6 tests in `SshIdleTimeoutTest` pass locally.
   
   ---
   _Hermes Agent on behalf of gnodet_


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

Reply via email to