{"record":{"id":"7cc4a8158240ad7d","repo":"pentaho/pentaho-kettle","slug":"interrupted-exception-while-running-the-process","errorCode":null,"errorMessage":"Interrupted exception while running the process ","messagePattern":"Interrupted exception while running the process ","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"warning","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java","lineNumber":232,"sourceCode":"      } else {\n        // get output stream\n        processresult.setOutputStream( getOutputString( new BufferedReader( new InputStreamReader( p\n          .getInputStream() ) ) ) );\n\n        // get error message\n        processresult.setErrorStream( getOutputString( new BufferedReader( new InputStreamReader( p\n          .getErrorStream() ) ) ) );\n\n        // Wait until end\n        p.waitFor();\n\n        // get exit status\n        processresult.setExistStatus( p.exitValue() );\n      }\n    } catch ( IOException ioe ) {\n      throw new KettleException( \"IO exception while running the process \" + Arrays.toString( process ) + \"!\", ioe );\n    } catch ( InterruptedException ie ) {\n      throw new KettleException( \"Interrupted exception while running the process \" + Arrays.toString( process ) + \"!\", ie );\n    } catch ( Exception e ) {\n      throw new KettleException( e );\n    } finally {\n      if ( p != null ) {\n        p.destroy();\n      }\n    }\n  }\n\n  private String getOutputString( BufferedReader b ) throws IOException {\n    StringBuilder retvalBuff = new StringBuilder();\n    String line;\n    String delim = meta.getOutputLineDelimiter();\n    if ( delim == null ) {\n      delim = \"\";\n    } else {\n      delim = environmentSubstitute( delim );\n    }","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/execprocess/ExecProcess.java#L214-L250","documentation":"The thread running ExecProcess was interrupted while waiting (p.waitFor / stream reads) for the child process; Kettle rethrows it as a KettleException naming the command. Usually means the transformation/step was cancelled or its execution thread killed.","triggerScenarios":"execProcess: InterruptedException from p.waitFor() or buffered stream reads — step cancelled via Spoon/execution stop, transformation timeout/shutdown, or the parent thread interrupted programmatically.","commonSituations":"User hits 'Stop' in Spoon while a long-running external process executes; cluster/timeout policies killing worker threads; JVM shutdown hooks; misconfigured timeouts cancelling the transformation.","solutions":["Re-interrupt the current thread in surrounding handling and treat as a cancellation, not a retryable error.","Investigate why the transformation was stopped (manual stop, timeout, shutdown) before retrying.","Make the external command finish faster or run it asynchronously outside the transformation.","Avoid killing/timeout-terminating transformations with long child processes; use safe cancellation points."],"exampleFix":"// before: retrying blindly after cancellation\nwhile (true) { execProcess(...); }\n// after: respect interruption\ntry {\n  ProcessResult r = execProcess(...);\n} catch (KettleException e) {\n  if (e.getCause() instanceof InterruptedException) {\n    Thread.currentThread().interrupt();\n    return; // stop processing\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { execProcess(...); } catch (KettleException e) { if (e.getCause() instanceof InterruptedException) { Thread.currentThread().interrupt(); return; } throw e; }","preventionTips":["Avoid stopping transformations mid child-process execution","Set realistic timeouts for long-running commands","Handle interruption as cancellation, never auto-retry"],"tags":["interruption","process-execution","cancellation","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"}