Eason09053360 opened a new pull request, #72464:
URL: https://github.com/apache/airflow/pull/72464

   `SubCommand.process` is only assigned once the worker thread reaches 
`Popen`, so a component whose executable could not be spawned — `airflow` 
missing from the subprocess `PATH` is the usual way in — leaves the attribute 
absent rather than empty.
   
   That matters more than the `AttributeError` suggests. Shutdown terminates 
the components in a single loop:
   
   ```python
   for command in self.subcommands.values():
       command.stop()
   for command in self.subcommands.values():
       command.join()
   ```
   
   The dict is ordered scheduler, dag-processor, api-server, triggerer, so if 
the scheduler is the one that failed, the very first `stop()` raises and Python 
abandons the loop. The other three are never terminated and keep running 
against the metadata database after standalone has exited, with nothing on 
screen to say so.
   
   Declaring `process` in `__init__` and guarding `stop()` lets the loop 
finish, so the components that did start are shut down as intended.
   
   Deliberately not in scope, though the same shutdown path invites them: 
`join()` takes no timeout on non-daemon threads, `run()` does not report a 
failed spawn through `parent.print_error`, a second `KeyboardInterrupt` during 
shutdown is uncaught, and there is no SIGKILL escalation after SIGTERM. Those 
change how standalone behaves rather than repairing it, and #60971 already 
touches the same loop.
   
   The regression test drives the real shutdown loop with the failed component 
first, so it asserts the consequence — the surviving sibling still gets 
terminated — rather than only that no exception escapes.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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