Skip to content

🍒 [1.7] test(cloudxr): poll the run-flags cmdline read in test_background.py - #1453

Merged
ivany-nv merged 1 commit into
release/1.7.xfrom
ivany-nv/cloudxr-cmdline-poll-1.7
Nov 9, 2026
Merged

ivany-nv merged 1 commit into
release/1.7.xfrom
ivany-nv/cloudxr-cmdline-poll-1.7

Conversation

@ivany-nv

@ivany-nv ivany-nv commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Description

Cherry-pick of #1376 onto release/1.7.x. cloudxr_test_background failed intermittently because a just-spawned child's /proc/<pid>/cmdline can read empty or still show the parent's argv; the tests now wait for the child's own argv before reading it.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Testing

  • Clean git cherry-pick -x onto release/1.7.x; the patch is identical to the merged commit on main.
  • SKIP=check-copyright-year pre-commit run --all-files passes.
  • test_background.py against this branch's background.py: the cmdline tests passed 200 repeats. The full CTest run is this PR's CI.

No new test: this is the test fix itself.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the linter and formatter with SKIP=check-copyright-year pre-commit run --all-files
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix/feature works (or explained why not)
  • I have signed off all my commits (git commit -s) per the DCO

…1376)

* test(cloudxr): poll the run-flags cmdline read in test_background.py

Popen() can return while the child is still mid-exec, when its
/proc/<pid>/cmdline reads empty. test_reads_real_cmdline_without_a_trailing_empty
read the run flags at once and failed with `assert [] == ['--host-client']`.

Replace the per-reader read_pid() poll with _await_exec(), which waits for
the child's cmdline itself and fails clearly after 5s. Every test that reads
a just-spawned child's cmdline now calls it first, including the two that
expect no match: an empty cmdline made those pass without testing anything.

Signed-off-by: Ivan Yang <yifanyang@nvidia.com>

* test(cloudxr): wait for the child's own argv, not just a non-empty cmdline

On the posix_spawn path the child shares our memory until exec swaps it,
so /proc/<pid>/cmdline can briefly read pytest's own argv. _await_exec
then returned at once, and the next read could still miss the service.
CPython 3.13 takes that path by default where os.POSIX_SPAWN_CLOSEFROM
exists; uv's managed builds lack it, so CI is unaffected.

Forced onto posix_spawn, the previous helper failed 7 of 10,000 runs of
the cmdline tests; this one failed none.

Signed-off-by: Ivan Yang <yifanyang@nvidia.com>

---------

Signed-off-by: Ivan Yang <yifanyang@nvidia.com>
(cherry picked from commit ce2d32f)
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@ivany-nv ivany-nv changed the title [1.7] test(cloudxr): poll the run-flags cmdline read in test_background.py 🍒 [1.7] test(cloudxr): poll the run-flags cmdline read in test_background.py Nov 9, 2026
@ivany-nv ivany-nv added the NVIDIA label Nov 9, 2026
@ivany-nv ivany-nv self-assigned this Nov 9, 2026
@ivany-nv
ivany-nv merged commit c477d21 into release/1.7.x Nov 9, 2026
33 checks passed
@ivany-nv
ivany-nv deleted the ivany-nv/cloudxr-cmdline-poll-1.7 branch November 9, 2026 21:09

This branch was successfully deployed

1 active deployment
dev — b42f90ee Deployed Nov 9, 2026 by ivany-nv via publish-wheel #6673
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants