{"record":{"id":"c9b009ac031a9f2a","repo":"pentaho/pentaho-kettle","slug":"ssh-connection-timed-out-after-ms","errorCode":null,"errorMessage":"SSH connection timed out after ms","messagePattern":"SSH connection timed out after ms","errorType":"exception","errorClass":"SshTimeoutException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/core/ssh/mina/MinaSshConnection.java","lineNumber":262,"sourceCode":"    // immediately without waiting for connection completion. Use no-argument await() for\n    // non-positive timeouts; it waits\n    // until the connection is established with no deadline imposed.\n    long connectTimeout = config.getConnectTimeoutMillis();\n    boolean connected;\n\n    try {\n      if ( connectTimeout > 0 ) {\n        connected = cf.await( connectTimeout );\n      } else {\n        connected = cf.await();\n      }\n    } catch ( IOException e ) {\n      throw new SshConnectionException( \"SSH connection failed during await\", e );\n    }\n\n    if ( !connected ) {\n      if ( connectTimeout > 0 ) {\n        throw new SshTimeoutException( \"SSH connection timed out after \" + connectTimeout + \"ms\" );\n      }\n      throw new SshTimeoutException( \"SSH connection failed while waiting with no configured timeout\" );\n    }\n\n    if ( !cf.isConnected() ) {\n      Throwable cause = cf.getException();\n      throw new SshConnectionException( \"SSH connection failed\", cause );\n    }\n  }\n\n  private ClientSession establishSession( ConnectFuture cf ) throws SshConnectionException {\n    ClientSession s = cf.getSession();\n\n    if ( s == null ) {\n      throw new SshConnectionException( \"SSH connection failed - session is null\" );\n    }\n\n    return s;","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/core/ssh/mina/MinaSshConnection.java#L244-L280","documentation":"MinaSshConnection.waitForConnection throws SshTimeoutException when the Apache MINA SSHD ConnectFuture never completes within the configured connectTimeout. The connect() call gives up waiting for the TCP/SSH handshake instead of blocking forever. It signals the host was unreachable or too slow, not an authentication problem.","triggerScenarios":"connect() is called with connectTimeout > 0 and the future does not report connected state before the deadline elapses — e.g. host down, wrong port, firewall dropping packets, or slow network.","commonSituations":"Typo in hostname/port in Spoon job config; SSH service not running on the remote host; corporate firewall silently dropping outbound port 22; EC2 security group not allowing the client IP.","solutions":["Verify the host is reachable: ping/telnet the host on the SSH port before running the transformation","Check the configured port matches the SSH server (default 22)","Increase the connection timeout in the SSH connection config if the network is slow","Check firewall/security-group rules allow outbound access from the Pentaho host","Confirm sshd is running on the remote host (systemctl status sshd)"],"exampleFix":"// before\nconfig.setConnectTimeout(0); // no/infinite timeout, hangs or misbehaves\n// after\nconfig.setConnectTimeout(30000); // 30s explicit timeout","handlingStrategy":"retry","validationCode":"// before connect()\nInetAddress addr = InetAddress.getByName( host );\ntry ( Socket s = new Socket() ) {\n  s.connect( new InetSocketAddress( addr, port ), 5000 ); // TCP probe; if this fails, SSH connect will time out too\n}","typeGuard":null,"tryCatchPattern":"try { conn.connect(); }\ncatch ( SshTimeoutException e ) {\n  log.warn( \"SSH connect timed out: {}\", e.getMessage() );\n  // bounded retry with backoff\n}\n","preventionTips":["Always set a positive connectTimeout instead of 0/unlimited","Probe host:port reachability before running the job","Document required firewall openings for the Pentaho host","Monitor network latency between Pentaho and SSH targets"],"tags":["ssh","network","timeout","mina-sshd"],"backgroundTag":"request-timeout","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}