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

twolf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 6e29d07935f0da03dca1d94275a7c55bb50b362f
Author: Thomas Wolf <[email protected]>
AuthorDate: Sat Sep 20 16:35:19 2025 +0200

    SftpTransferTest: log exceptions
    
    I got some flaky runs on this test. No idea what happened, the server
    first gets a "connection reset" IOException, and then later logs a
    "IllegalStateException: Not initialized", unfortunately without stack
    trace.
    
    The additional logging will include the stack trace, which will be
    contained in the test XML for the flaky run. Hopefully that gives some
    insight as to where this IllegalStateException is coming from.
---
 .../org/apache/sshd/sftp/client/SftpTransferTest.java   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git 
a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTransferTest.java 
b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTransferTest.java
index e7998524d..b3db683f5 100644
--- a/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTransferTest.java
+++ b/sshd-sftp/src/test/java/org/apache/sshd/sftp/client/SftpTransferTest.java
@@ -29,18 +29,25 @@ import java.util.Date;
 import java.util.List;
 
 import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.session.Session;
+import org.apache.sshd.common.session.SessionListener;
 import org.apache.sshd.core.CoreModuleProperties;
 import org.apache.sshd.sftp.client.fs.SftpFileSystem;
+import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.MethodOrderer.MethodName;
 import org.junit.jupiter.api.TestMethodOrder;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static org.junit.jupiter.api.Assertions.fail;
 
 @TestMethodOrder(MethodName.class)
 public class SftpTransferTest extends AbstractSftpClientTestSupport {
 
+    private static final Logger LOG = 
LoggerFactory.getLogger(SftpTransferTest.class);
+
     private static final int BUFFER_SIZE = 8192;
 
     private long rekeyBlockSize;
@@ -56,6 +63,16 @@ public class SftpTransferTest extends 
AbstractSftpClientTestSupport {
         return params;
     }
 
+    @BeforeAll
+    static void logExceptions() {
+        sshd.addSessionListener(new SessionListener() {
+            @Override
+            public void sessionException(Session session, Throwable t) {
+                LOG.warn("**** Session {} caught exception", session, t);
+            }
+        });
+    }
+
     @MethodSource("getParameters")
     @ParameterizedTest(name = "REKEY_BLOCK_SIZE {0}")
     public void transferIntegrity(long rekeyBlockSize) throws IOException {

Reply via email to