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

   This PR aims to fix flakiness in 
`test_a_background_child_does_not_hold_the_call`.
   
   <details><summary>AI Summary</summary>
   `TestRunWrapper::test_a_background_child_does_not_hold_the_call` fails 
intermittently on CI with `assert []` on its last line, `assert survivors`.
   
   Root cause: the wrapper returns as soon as the command's shell exits. dash 
runs `sleep 304 &` by forking a child that then execs `sleep`. On a loaded 
runner the wrapper can return before that exec, while the child's 
`/proc/<pid>/cmdline` still reads `/bin/sh /tmp/.airflow-exec.*/c`. The test 
scanned `/proc` once right after the call, so it found no `sleep 304` although 
the child was running. The wrapper does not kill the child on the success path, 
so this is a test race, not a product bug.
   
   The test now polls for the child for up to 5 seconds, using the same idiom 
as `test_a_timer_starved_of_cpu_fires_on_elapsed_time`. It measures the 
wrapper's duration before the poll, so `elapsed < 5` still checks that the call 
does not wait for the background child.
   
   Reproduction, on a 16-core host with 32 busy loops, using a standalone 
script that runs the wrapper the way the test does:
   - single scan (old test): 1 failure in 300 runs; a second scan moments later 
found the process
   - polling (new test): race hit 5 times in 600 runs, all recovered, 0 failures
   
   `test_openshell.py` passes locally (161 passed).
   </details>
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 5.5)
   
   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)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


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