diff --git a/.changeset/python-stderr-deadlock-fix.md b/.changeset/python-stderr-deadlock-fix.md new file mode 100644 index 00000000000..3eef0c3aa96 --- /dev/null +++ b/.changeset/python-stderr-deadlock-fix.md @@ -0,0 +1,5 @@ +--- +"@trigger.dev/python": patch +--- + +Fix `python.runScript()` deadlock when the Python subprocess produces more than ~64KB of stderr output. The previous implementation hardcoded `OTEL_LOG_LEVEL: "DEBUG"` in the subprocess environment, which caused OTEL-aware Python libraries (mlflow, opentelemetry-sdk, etc.) to emit verbose debug-level logging to stderr during import. Once stderr exceeded the OS pipe buffer, the Python process would block on `write()` indefinitely. Removing the hardcoded debug log level brings `runScript()` in line with `run()`, `runInline()`, and the streaming variants — none of which set `OTEL_LOG_LEVEL`. diff --git a/packages/python/src/index.ts b/packages/python/src/index.ts index 6924802fd88..8d68db01dd4 100644 --- a/packages/python/src/index.ts +++ b/packages/python/src/index.ts @@ -97,7 +97,6 @@ export const python = { }=trigger,${Object.entries(taskContext.attributes) .map(([key, value]) => `${key}=${value}`) .join(",")}`, - OTEL_LOG_LEVEL: "DEBUG", }, }, throwOnError: false,