apache/seatunnel · error · IOException
Interrupted while writing python.script.config
Error message
Interrupted while writing python.script.config
What it means
During open(), a dedicated writer thread pushes the initial JSON config (python.script.config) to the child Python process's stdin. If the thread waiting on that writer is interrupted, the reader translates the InterruptedException into an IOException with this message, restores the interrupt flag, and fails source initialization.
Source
Thrown at seatunnel-connectors-v2/connector-python/src/main/java/org/apache/seatunnel/connectors/seatunnel/python/source/PythonSourceReader.java:347
writeInitialScriptConfig(scriptConfig);
} catch (Exception e) {
stdinWriterFailure = e;
} finally {
initialConfigWritten = true;
}
},
"python-source-stdin-writer");
stdinWriterThread.setDaemon(true);
stdinWriterThread.start();
}
/** Fails process initialization when the child does not consume the initial JSON contract. */
private void waitForInitialConfigWrite() throws IOException {
try {
stdinWriterThread.join(TimeUnit.SECONDS.toMillis(INITIAL_CONFIG_WRITE_TIMEOUT_SECONDS));
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IOException("Interrupted while writing python.script.config", e);
}
if (closeRequested) {
throw new IOException("Python source was closed while writing python.script.config");
}
if (!initialConfigWritten) {
throw new IOException(
"Timed out after "
+ INITIAL_CONFIG_WRITE_TIMEOUT_SECONDS
+ " seconds while writing python.script.config; ensure the Python script reads its first stdin line");
}
if (stdinWriterFailure != null) {
if (!process.isAlive()) {
// A closed stdin pipe surfaces here as a generic write IOException (e.g. "Broken
// pipe"), but the actual contract violation is that the script exited without
// reading python.script.config; report that instead of the write symptom.
throw new IOException(
"Python script exited before reading its first stdin line;"View on GitHub (pinned to cf67b549a7)
Solutions
- Retry opening the source after ensuring the job was not cancelled
- If seen frequently during shutdown, it is benign — the job is being torn down
- Check for upstream components spamming interrupts (e.g. timeouts in the execution layer)
Defensive patterns
Strategy: retry
Try / catch
try {
reader.open();
} catch (IOException e) {
if (e.getMessage().contains("Interrupted while writing python.script.config")) {
Thread.currentThread().isInterrupted(); // check restart policy
}
} Prevention
- Don't cancel jobs during source open; allow startup grace period
- Check that no other component interrupts task threads during initialization
When it happens
Trigger: The thread running open()/waitForInitialConfigWrite receives an interrupt (e.g. task cancellation by the engine, checkpoint cancel, job shutdown) while joining the stdin writer thread.
Common situations: Job cancelled or failing mid-source-open; engine task manager interrupting tasks during cluster shutdown; manual stop of the Zeta job while the Python source is starting.
Related errors
- Python script exited before reading its first stdin line; py
- Interrupted while draining Python source stdout after proces
- Interrupted while draining python source process output
- deploy mode not support : ${MODE}
- Failed to open AmazonDocumentDB source reader for database [
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/cc99014bc3298392.
Report an issue: GitHub.