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

   `@enable_memray_trace` was on the dag-processor's outer CLI function. Both 
paths
   that function takes — `run_command_with_daemon_option` and, under `--dev`,
   `run_with_reloader` — fork before the job runs, and `memray.Tracker` 
defaults to
   `follow_fork=False`. So the tracer stayed with the parent while every 
allocation
   worth measuring happened in the child, and an opted-in user got a capture 
file
   containing interpreter startup instead of the profile they asked for. 
   It fails silently: the file looks perfectly normal.
   
   The three sibling components already decorate their inner run function —
   `_run_scheduler_job`, `triggerer_run`, `_run_api_server`. This makes
   dag-processor match them by extracting `_run_dag_processor_job` and moving 
the
   decorator onto it.
   
   `set_component_mp_start_method()` and `_create_dag_processor_job_runner()`
   deliberately stay in the parent. The latter calls `validate_dag_bundle_arg`,
   which raises `SystemExit` on an unknown `--bundle-name`; moving it past the 
fork
   would bury that error in a daemonized child where the user never sees it.
   
   No behaviour change for anyone who has not opted in — `[profiling]
   memray_trace_components` is unset by default.
   
   The regression test asserts the invariant behaviourally rather than 
structurally:
   no `memray.Tracker` may be constructed while the CLI function runs, and 
exactly
   one must be constructed when the callback that lands on the far side of the 
fork
   is invoked. Verified failing against the unfixed code both whole-file and in 
isolation.
   
   ---
   
   ##### 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