potiuk opened a new pull request, #67782: URL: https://github.com/apache/airflow/pull/67782
The triggerer test `test_trigger_runner_exception_stops_triggerer` is flaky on slow CI runners (e.g. [this run](https://github.com/apache/airflow/actions/runs/26601202968/job/78387697668)): ``` assert job_runner._execute() == -9 E AttributeError: 'TriggererJobRunner' object has no attribute 'trigger_runner' ``` The test arms a `SIGALRM` timer for 0.1s and then calls `_execute()`; the handler reads `job_runner.trigger_runner.pid` to `SIGKILL` the subprocess. But `self.trigger_runner` is only assigned **inside** `_execute()`, after the supervisor subprocess is forked. On a slow/loaded runner the timer fires before that assignment, so the attribute does not yet exist. This also exposed a latent robustness gap: `on_kill()`, `_exit_gracefully()`, and the `_execute()` `finally` block all reference `self.trigger_runner`, which would raise `AttributeError` if a signal arrives (or `TriggerRunnerSupervisor.start()` raises) before the attribute is set. **Fix:** - Initialize `self.trigger_runner = None` in `__init__` so all early access is `None`-safe (and guard the `_execute()` `finally` kill against `None`). - Re-arm the timer in the test's signal handler when the subprocess has not started yet, instead of dereferencing a not-yet-created runner. Verified by running the test 5x locally — consistently green. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes — Claude Code (Opus 4.8) Generated-by: Claude Code (Opus 4.8) 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]
