[ 
https://issues.apache.org/jira/browse/CAMEL-25343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18124460#comment-18124460
 ] 

Guillaume Nodet commented on CAMEL-25343:
-----------------------------------------

This issue is being investigated by a coding agent (on behalf of gnodet).

Root cause identified: the test testIdleTimeoutExpiresBeforeCommandCompletes 
has a timing race condition. The DelayedEchoCommandFactory uses a 1000ms 
command delay with a 500ms client-side idle timeout — a 2:1 ratio that is too 
narrow on loaded CI. Apache MINA SSHD's idle timeout is not a hard real-time 
timer; it is checked periodically by the I/O event loop, and the idle clock 
only starts after the SSH handshake and channel open complete (both of which 
generate I/O resets). Under parallel builds (-T1C), scheduling jitter can push 
the idle timeout check past the 1000ms command delay, causing the command to 
complete before session teardown and assertNull(exitValue) to fail with 
non-null.

Fix: widen the timing margin significantly — increase the server-side command 
delay (e.g., to 5000ms) while keeping the 500ms idle timeout, giving a 10x 
ratio that makes the race negligible.

_Note: This comment was generated by an AI coding agent and requires manual 
verification._


> Fix flaky test SshIdleTimeoutTest.testIdleTimeoutExpiresBeforeCommandCompletes
> ------------------------------------------------------------------------------
>
>                 Key: CAMEL-25343
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25343
>             Project: Camel
>          Issue Type: Test
>          Components: camel-ssh
>    Affects Versions: 4.23.0
>            Reporter: Aurélien Pupier
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> [failed 2 times and flaky 7 times in last 90 
> days|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]
> it is failing a lot more when the full build is launched with -T1C
> {noformat}
> 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>  
>       at org.junit.jupiter.api.Assertions.assertNull(Assertions.java:317)     
>       at 
> org.apache.camel.component.ssh.SshIdleTimeoutTest.testIdleTimeoutExpiresBeforeCommandCompletes(SshIdleTimeoutTest.java:133)
>   
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to