Skip to content

[CI/Build] Avoid busy polling in stage memory lifecycle tests - #9406

Merged
amy-why-3459 merged 2 commits into
vllm-project:mainfrom
amy-why-3459:fix/9401-stage-memory-flake
Oct 26, 2026
Merged

amy-why-3459 merged 2 commits into
vllm-project:mainfrom
amy-why-3459:fix/9401-stage-memory-flake

Conversation

@amy-why-3459

@amy-why-3459 amy-why-3459 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Purpose

Fixes #9401.

The stage-memory lifecycle tests poll Prometheus samples with asyncio.sleep(0) while replica registration waits for an asyncio.to_thread worker. The continuously runnable poller can starve that worker of the GIL and exhaust the two-second deadline before the replacement snapshot is published.

Use a 1 ms polling interval so the event loop can actually suspend between checks. Keep the two-second deadline and every lifecycle assertion, including protection against a detached RPC overwriting its replacement's snapshot.

This only changes the test helper. Runtime behavior, the metrics contract, configuration, and user documentation are unchanged.

Contributor intent

  1. Outcome: Fix the flaky stage-memory lifecycle test reported in [Bug][Flaky]: READY CI failed - tests/engine/test_stage_memory_lifecycle.py::test_detached_rpc_cannot_overwrite_replacement_snapshot[join] - TimeoutError #9401.
  2. Highest-leverage variable: Test determinism under CI scheduling pressure.
  3. How this moves it: Remove the polling-induced scheduling contention without weakening the assertions or increasing the timeout.
  4. Users and needs: Contributors and maintainers need READY CI results that are not blocked by timing-sensitive false failures.

Test plan and results

Environment: Linux, Python 3.12.13, vLLM 0.32.0, PyTorch 2.13.0+cu130, pytest 9.1.1, pytest-asyncio 1.4.0. Base: 2c324487942a04fb29ee82d74781292080b070b9.

The unmodified file passed 550 ordinary repeated cases. To expose scheduling sensitivity, pin execution to one CPU after collection and increase the interpreter's thread-switch interval. On this host, the following command reproduced the exact join timeout while waiting for (101, 103): 1 failed, 141 passed before the change; 220 passed after it. This is a local stress reproducer, not a replay of the Buildkite environment. CPU 110 must be replaced with an allowed CPU on other hosts; requires pytest-repeat.

python - <<'PY'
import os, sys, pytest
class Stress:
    def pytest_collection_finish(self, session):
        os.sched_setaffinity(0, {110})
        sys.setswitchinterval(0.1)
raise SystemExit(pytest.main(['tests/engine/test_stage_memory_lifecycle.py', '-q', '--count=20', '-x'], plugins=[Stress()]))
PY

Related regression tests: 45 passed.

python -m pytest tests/engine/test_stage_memory_lifecycle.py tests/engine/test_membership_controller.py tests/engine/test_stage_pool_collective_rpc.py -q

pre-commit run --files tests/engine/test_stage_memory_lifecycle.py: all applicable hooks passed, including Ruff, mypy, CI marks, SPDX and forbidden-import checks. Full pre-submit self-check found no additional diff-scoped issues or simplification candidates.

For a focused CI-style run in an environment with the repository's test dependencies (no model weights or GPU execution required):

python -m pytest tests/engine/test_stage_memory_lifecycle.py -m 'core_model and cpu' --run-level core_model -q

The full READY suite was not run locally. The local environment emitted an existing package-version warning: installed vLLM-Omni metadata reports 0.31.0rc2 while vLLM reports 0.32.0; tests imported this worktree's source.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Signed-off-by: amy-why-3459 <wuhaiyan17@huawei.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-26T08:30:36.874510Z
We couldn’t complete this review. Comment @codex review to try again.
0671c96 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@vllm-omni-review-bot

Copy link
Copy Markdown

This PR was classified as CI work.

CI owner: @yenuo26 @NickCao

Routing: @yenuo26 via CI owner, CODEOWNERS; @NickCao via CODEOWNERS

@amy-why-3459, please review your own changes and leave a short self-review comment describing what you checked. PRs without author self-review may not be assigned a reviewer.

Please take a look when you have a chance. If you would like an automated review, mention @vllm-omni-review-bot in a comment.

@amy-why-3459 amy-why-3459 added the ready label to trigger buildkite CI label Oct 26, 2026
@vllm-omni-review-bot

Copy link
Copy Markdown

Omni ReviewBot triage note

Automated triage of commit 72ad601d876a produced:

  • Priority: high. Prompt maintainer attention is suggested.

These are automated triage suggestions only — the final decision belongs to the maintainers.

@amy-why-3459
amy-why-3459 enabled auto-merge (squash) October 26, 2026 08:53
@hsliuustc0106 hsliuustc0106 added the high priority high priority issue, needs to be done asap label Oct 26, 2026 — with ChatGPT Codex Connector
@amy-why-3459
amy-why-3459 merged commit 13c1e82 into vllm-project:main Oct 26, 2026
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

high priority high priority issue, needs to be done asap ready label to trigger buildkite CI

Projects

None yet

4 participants