{"record":{"id":"9d3efc9667578628","repo":"pentaho/pentaho-kettle","slug":"interrupted-while-trying-to-connect-to-server-socket-e","errorCode":null,"errorMessage":"Interrupted while trying to connect to server socket: {e}","messagePattern":"Interrupted while trying to connect to server socket: (.+?)","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/step/RemoteStep.java","lineNumber":629,"sourceCode":"        lastException = null;\n      } catch ( Exception e ) {\n        lastException =\n          new KettleException( \"Unable to open socket to server \" + realHostname + \" port \" + portNumber, e );\n      }\n      if ( lastException != null ) {\n        // Sleep for a while\n        try {\n          Thread.sleep( 250 );\n        } catch ( InterruptedException e ) {\n          if ( socket != null ) {\n            socket.shutdownInput();\n            socket.shutdownOutput();\n            socket.close();\n            baseStep.logDetailed( \"Closed connection to server socket to read rows from remote step on server \"\n              + realHostname + \" port \" + portNumber + \" - Local port=\" + socket.getLocalPort() );\n          }\n\n          throw new KettleException( \"Interrupted while trying to connect to server socket: \" + e.toString() );\n        }\n      }\n    }\n\n    // See if all was OK...\n    if ( lastException != null ) {\n\n      baseStep.logError( \"Error initialising step: \" + lastException.toString() );\n      if ( socket != null ) {\n        socket.shutdownInput();\n        socket.shutdownOutput();\n        socket.close();\n        baseStep.logDetailed( \"Closed connection to server socket to read rows from remote step on server \"\n          + realHostname + \" port \" + portNumber + \" - Local port=\" + socket.getLocalPort() );\n      }\n      throw lastException;\n    } else {\n      if ( inputStream == null ) {","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/step/RemoteStep.java#L611-L647","documentation":"Thrown by RemoteStep.openReaderSocket when the loop that repeatedly attempts to connect to the remote server socket is interrupted (the worker thread receives InterruptedException). The connection attempt is aborted and the interrupt condition is reported as a KettleException.","triggerScenarios":"The transformation is stopped/cancelled while openReaderSocket is still retrying to connect to the remote slave's server socket, so the sleeping/connecting thread is interrupted.","commonSituations":"Users hitting Stop in Spoon while a clustered transformation is waiting for the remote step's socket writer to come up; trans.stopAll() interrupting socket wait threads.","solutions":["If the stop was intentional, treat this as expected cancellation; check the transformation log for 'Stopped' entries.","If unintentional, check for code calling trans.stopAll() or Thread.interrupt() during startup.","Verify the remote slave server is reachable and the SocketWriter starts quickly enough that no long retry loop is needed.","Increase TIMEOUT_IN_SECONDS-related budgets or reduce cluster startup latency so the socket opens before interruption."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Detect a stop request before opening the remote reader\nif (trans.isStopped()) { return; // skip openReaderSocket, transformation is being cancelled }","typeGuard":null,"tryCatchPattern":"try { remoteStep.openReaderSocket(baseStep); } catch (KettleException e) { if (e.getMessage().startsWith(\"Interrupted while trying to connect\")) { log.warn(\"Connection wait was interrupted by a stop request\"); } else { throw e; } }","preventionTips":["Check trans.isStopped() before and during clustered startup","Avoid interrupting transformation threads programmatically","Ensure slave servers start promptly so the retry loop exits quickly"],"tags":["kettle","socket","interrupted","cluster","threading"],"backgroundTag":"thread-interrupted","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"}