cmettler commented on code in PR #65738:
URL: https://github.com/apache/airflow/pull/65738#discussion_r3523697763


##########
task-sdk/src/airflow/sdk/execution_time/supervisor.py:
##########
@@ -690,6 +690,16 @@ def start(
 
         pid = os.fork()
         if pid == 0:
+            # Put the task-runner into its own session so its PGID == its own
+            # PID. The supervisor can then deliver signals to the whole tree
+            # via os.killpg() in kill(), reaching every subprocess the
+            # task-runner spawned (e.g. venv children from
+            # PythonVirtualenvOperator). Without this, a SIGTERM from kill()
+            # only hits the task-runner and any Popen children are reparented
+            # to PID 1 and leak as orphans. See issue #65505.
+            with suppress(OSError):
+                os.setsid()

Review Comment:
   Done — switched to the `use_exec` pattern: a `new_process_group: bool = 
False` param on `start()` that only `ActivitySubprocess` sets, with the 
`killpg` branch in `kill()` gated on it, so the DAG processor, triggerer and 
callback subprocesses keep direct signalling. Also switched from `setsid()` to 
`setpgid()` per your later comment (matching `set_new_process_group` 
semantics), and dropped the stale session-leader TODO.
   
   ---
   Drafted-by: Claude Code (Opus 4.7); reviewed by @cmettler before posting



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to