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

   When a breakpoint stops a task that `dag.test()` runs under a pydevd-based 
debugger (VS Code's debugpy, PyCharm), pydevd suspends every other thread in 
the process, including `InProcessExecutionAPI-loop`, the event loop thread the 
in-process Execution API answers on. A Debug Console expression that calls the 
Execution API, such as 
`get_current_context()["ti"].xcom_pull(task_ids="numbers")` or 
`Variable.get(...)`, then waits forever. pydevd's own warning names the cause 
and the remedy: a thread that should keep running can set `pydev_do_not_trace = 
True`.
   
   **Solution**: `InProcessExecutionAPI` gets a `serve_while_debugger_paused` 
option that marks the loop thread `pydev_do_not_trace = True`. Only 
`in_process_api_server()` passes it, since that instance's callers 
(`dag.test()`'s `InProcessTestSupervisor`) are in the same process. The Dag 
processor's and the triggerer's instances are unchanged: their callers are 
other processes, relayed by the main thread, which a pause stops anyway.
   
   **Trade-off.** `pydev_do_not_trace` also turns off tracing in that thread, 
and pydevd has no setting that keeps a thread running yet traced, so 
breakpoints in Execution API route code no longer stop for requests from 
`dag.test()`. They still work in the Dag processor and the triggerer. pydevd's 
alternative, `PYDEVD_UNBLOCK_THREADS_TIMEOUT`, has to be set by each user, 
makes every such evaluation wait out the timeout, and then resumes all threads.
   
   
   related: #51861
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Opus 5.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