{"record":{"id":"b238208932acbdf1","repo":"apache/seatunnel","slug":"stringutils-stringifyexception-e","errorCode":null,"errorMessage":"StringUtils.stringifyException(e)","messagePattern":"StringUtils\\.stringifyException\\(e\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPConnectionPool.java","lineNumber":103,"sourceCode":"        if (info == null) {\n            return false;\n        }\n        HashSet<ChannelSftp> cons = idleConnections.get(info);\n        if (cons == null) {\n            cons = new HashSet<ChannelSftp>();\n            idleConnections.put(info, cons);\n        }\n        cons.add(channel);\n        return true;\n    }\n\n    /** Register a newly opened connection unless shutdown won the race. */\n    boolean registerConnection(ChannelSftp channel, ConnectionInfo info) throws IOException {\n        try {\n            return registerConnection(channel, channel.getSession(), info);\n        } catch (JSchException e) {\n            closeChannel(channel, null);\n            throw new IOException(StringUtils.stringifyException(e));\n        }\n    }\n\n    /** Register the channel together with the session captured when the connection was opened. */\n    private boolean registerConnection(ChannelSftp channel, Session session, ConnectionInfo info)\n            throws IOException {\n        synchronized (this) {\n            if (con2infoMap != null) {\n                con2infoMap.put(channel, info);\n                con2sessionMap.put(channel, session);\n                liveConnectionCount++;\n                return true;\n            }\n        }\n        closeChannel(channel, session);\n        return false;\n    }\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPConnectionPool.java#L85-L121","documentation":"registerConnection wraps JSchException raised while registering a newly opened SFTP channel/session into the pool, converting it to an IOException whose message is the full stack trace produced by StringUtils.stringifyException(e). It indicates the SSH layer failed (auth, session state, transport) during pool registration.","triggerScenarios":"channel.connect()/session handshake succeeded enough to open the channel, but the second registerConnection(channel, channel.getSession(), info) path throws JSchException — e.g. session dropped between connect and registration, or the channel cannot provide its session.","commonSituations":"Flaky SSH network, server-side session limits reached, wrong host key/auth config causing intermittent JSch failures, firewall dropping the connection mid-handshake.","solutions":["Read the embedded stack trace (the message IS the trace) to find the underlying JSch failure and fix that root cause","Verify SFTP host/port/credentials and host-key configuration","Check server MaxSessions/MaxStartups limits (sshd_config) and connection count against the pool's maxConnection","Add retry with backoff around filesystem initialization for transient SSH failures"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight connectivity check before initializing the pool\nnew JSch().getSession(user, host, port).connect(timeout);","typeGuard":null,"tryCatchPattern":"try {\n    fs.initialize(uri, conf);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"com.jcraft.jsch.JSchException\")) retryWithBackoff();\n    else throw e;\n}","preventionTips":["Pre-validate SSH reachability and credentials with a lightweight probe","Raise sshd MaxSessions/MaxStartups if running many parallel tasks","Log and inspect the embedded stack trace (message contains full trace) to fix the root JSch cause"],"tags":["sftp","ssh","jsch"],"backgroundTag":"ssh-connection-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}