vllm - ✅(Solved) Fix [bug] `spawn_new_process_for_each_test` decorator broken [2 pull requests, 6 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#41415Fetched 2026-05-01 05:33:43
View on GitHub
Comments
6
Participants
4
Timeline
43
Reactions
0
Timeline (top)
mentioned ×14subscribed ×14commented ×6labeled ×3

Root Cause

This is critical, because it means the tests using the decorator are not actually getting run, so we might have a bunch of silent failures.

Fix Action

Fixed

PR fix notes

PR #41423: [Bugfix] Fix spawn_new_process_for_each_test silently swallowing test failures

Description (problem / solution / changelog)

Problem

spawn_new_process_for_each_test was broken — it always passed regardless of what the test function did, causing silent test coverage failures.

The previous implementation ran python -m <module_name> in the child process, which re-executed the module's __main__ block instead of actually calling the test function. check_returncode() always saw exit 0, so any exception raised inside the test was silently swallowed.

Repro from the issue:

@create_new_process_for_each_test("spawn")
def test_failing():
    raise ValueError  # always passed before this fix

Fix

Serialize the test function and its arguments with cloudpickle and pass them to a minimal child script via stdin. The child writes its full traceback to a temp file on failure; the parent reads it and raises RuntimeError with the traceback included, making CI failures actionable.

This matches the robustness of fork_new_process_for_each_test which already handled exception propagation correctly.

Verification

Tested locally with the exact repro from #41415:

Testing failure propagation...
FIXED: failure correctly propagated
Test subprocess 'test_failing' failed (exit code 1):
Traceback (most recent call last):
  File "<string>", line 4, in <module>
    f(*args, **kwargs)
  File "/tmp/test_fix3.py", line 45, in test_failing
    raise ValueError('should propagate')
ValueError: should propagate

Testing success case...
FIXED: success case passes cleanly
  • Failing tests now correctly raise RuntimeError with the full traceback from the child process
  • Passing tests continue to work normally

Fixes #41415

Changed files

  • tests/test_spawn_decorator.py (added, +38/-0)
  • tests/utils.py (modified, +49/-35)

PR #41425: [Bugfix] Fix spawn decorator never executing the test function

Description (problem / solution / changelog)

Purpose

Fix spawn_new_process_for_each_test always passing tests regardless of whether the test function raised an exception. Fixes #41415, spotted in #36823.

Two bugs in the decorator:

  1. Subprocess was launched with python -m <module> which only imports the module and exits. stdin was never read so f was never called.
  2. args and kwargs were missing from the pickled payload, so parametrized tests would not receive their arguments.

Test Plan

bash python -c " from tests.utils import create_new_process_for_each_test

@create_new_process_for_each_test('spawn') def test_failing(): raise ValueError('intentional failure')

try: test_failing() print('BROKEN: passed when it should have failed') except RuntimeError: print('FIXED: correctly raised RuntimeError')

Test Result

Testing failure propagation... FIXED: failure correctly propagated

Testing success case... FIXED: success case passes cleanly

Testing args and kwargs... FIXED: args and kwargs forwarded correctly

Changed files

  • tests/utils.py (modified, +22/-27)

Code Example

@create_new_process_for_each_test("spawn")
def test_failing():
    raise ValueError

---

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================ 1 passed, 17 warnings in 11.40s ============================================================================================
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute
RAW_BUFFERClick to expand / collapse

The spawn decorator for tests is broken, it always passes no matter what the decorated function does.

This is critical, because it means the tests using the decorator are not actually getting run, so we might have a bunch of silent failures.

Pointed out by Claude in this PR comment.

Repro:

@create_new_process_for_each_test("spawn")
def test_failing():
    raise ValueError

Output:

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================================================================ 1 passed, 17 warnings in 11.40s ============================================================================================
sys:1: DeprecationWarning: builtin type swigvarlink has no __module__ attribute

cc @vllmellm @tjtanaa

extent analysis

TL;DR

The issue can likely be resolved by modifying the spawn decorator to properly handle and propagate exceptions from the decorated functions.

Guidance

  • Investigate the implementation of the create_new_process_for_each_test decorator to ensure it correctly handles exceptions raised by the decorated functions.
  • Verify that the decorator is properly waiting for and checking the results of the spawned processes.
  • Check if the decorator is swallowing or ignoring exceptions, which could cause the tests to appear as passing when they should be failing.
  • Review the documentation for the testing framework being used (e.g. pytest) to ensure the decorator is being used correctly.

Example

No example code is provided due to lack of information about the decorator's implementation.

Notes

The exact solution will depend on the implementation details of the create_new_process_for_each_test decorator, which are not provided in the issue.

Recommendation

Apply a workaround by modifying the decorator to handle exceptions correctly, as the root cause appears to be related to the decorator's implementation.

FAIL-SAFE

Given the lack of information about the decorator's implementation, it's essential to carefully review the code and documentation for the testing framework being used.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - ✅(Solved) Fix [bug] `spawn_new_process_for_each_test` decorator broken [2 pull requests, 6 comments, 4 participants]