Skip to content

[CI/Build] Clean up timed-out K8s E2E runs and fail fast on backend exits - #1031

Merged
ruizhang0101 merged 4 commits into
vllm-project:mainfrom
lfsun02:fix/router-e2e-cleanup-and-fail-fast
Aug 10, 2026
Merged

ruizhang0101 merged 4 commits into
vllm-project:mainfrom
lfsun02:fix/router-e2e-cleanup-and-fail-fast

Conversation

@lfsun02

@lfsun02 lfsun02 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

In several recent PRs, a timed-out K8s E2E test could leave GPU pods running, causing the subsequent static-discovery job to fail due to insufficient GPU memory. The job then continued polling the unreachable backends even though their processes had already exited.
A representative example is PR #1027, attempt 2:

This PR improves failure handling and observability in the router E2E workflow:

  • always uninstall the K8s discovery Helm release after the test step, including when the step times out.

  • track the two static backend processes while waiting for them to become reachable, fail immediately if either backend exits during startup.

  • print the last 50 lines of the relevant backend log.

BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE


  • Make sure the code changes pass the pre-commit checks.
  • Sign-off your commit by using -s when doing git commit
  • Try to classify PRs for easy understanding of the type of changes, such as [Bugfix], [Feat], and [CI].
Detailed Checklist (Click to Expand)

Thank you for your contribution to production-stack! Before submitting the pull request, please ensure the PR meets the following criteria. This helps us maintain the code quality and improve the efficiency of the review process.

PR Title and Classification

Please try to classify PRs for easy understanding of the type of changes. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:

  • [Bugfix] for bug fixes.
  • [CI/Build] for build or continuous integration improvements.
  • [Doc] for documentation fixes and improvements.
  • [Feat] for new features in the cluster (e.g., autoscaling, disaggregated prefill, etc.).
  • [Router] for changes to the vllm_router (e.g., routing algorithm, router observability, etc.).
  • [Misc] for PRs that do not fit the above categories. Please use this sparingly.

Note: If the PR spans more than one category, please include all relevant prefixes.

Code Quality

The PR need to meet the following code quality standards:

  • Pass all linter checks. Please use pre-commit to format your code. See README.md for installation.
  • The code need to be well-documented to ensure future contributors can easily understand the code.
  • Please include sufficient tests to ensure the change is stay correct and robust. This includes both unit tests and integration tests.

DCO and Signed-off-by

When contributing changes to this project, you must agree to the DCO. Commits must include a Signed-off-by: header which certifies agreement with the terms of the DCO.

Using -s with git commit will automatically add this header.

What to Expect for the Reviews

We aim to address all PRs in a timely manner. If no one reviews your PR within 5 days, please @-mention one of YuhanLiu11
, Shaoting-Feng or ApostaC.

lfsun02 added 2 commits August 5, 2026 00:15
Signed-off-by: Lifan Sun <lifansun1412@gmail.com>
Signed-off-by: Lifan Sun <lifansun1412@gmail.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the wait-for-backends.sh script by introducing process ID and log file tracking for the backends, allowing the script to fail early and print diagnostic logs if a backend exits. The review feedback suggests making the script more robust under set -e by ensuring print_backend_log always returns 0 and explicitly returning 0 from check_backend_process to avoid implicit exit status issues.

Comment on lines +14 to +22
print_backend_log() {
local backend_name=$1
local log_file=$2

if [ -n "$log_file" ] && [ -f "$log_file" ]; then
echo "Last 50 lines from ${backend_name} log (${log_file}):"
tail -n 50 "$log_file"
fi
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since print_backend_log is a diagnostic helper, any failure within it (e.g., if tail fails due to permission issues or if the file is removed) should not cause the entire script to exit under set -e.

To prevent this, we should ensure the function always returns 0 by appending || true to the tail command and adding an explicit return 0 at the end of the function.

Suggested change
print_backend_log() {
local backend_name=$1
local log_file=$2
if [ -n "$log_file" ] && [ -f "$log_file" ]; then
echo "Last 50 lines from ${backend_name} log (${log_file}):"
tail -n 50 "$log_file"
fi
}
print_backend_log() {
local backend_name=$1
local log_file=$2
if [ -n "$log_file" ] && [ -f "$log_file" ]; then
echo "Last 50 lines from ${backend_name} log (${log_file}):"
tail -n 50 "$log_file" || true
fi
return 0
}

Comment on lines +24 to +34
check_backend_process() {
local backend_name=$1
local backend_pid=$2
local log_file=$3

if [ -n "$backend_pid" ] && ! kill -0 "$backend_pid" 2>/dev/null; then
echo "❌ ${backend_name} process exited before becoming reachable"
print_backend_log "$backend_name" "$log_file"
return 1
fi
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Bash, if a function finishes without an explicit return, its exit status is that of the last executed command. If the if condition is false, the if statement returns 0, but relying on this implicit behavior can be fragile and less readable.

Adding an explicit return 0 at the end of check_backend_process makes the success path clear and robust.

Suggested change
check_backend_process() {
local backend_name=$1
local backend_pid=$2
local log_file=$3
if [ -n "$backend_pid" ] && ! kill -0 "$backend_pid" 2>/dev/null; then
echo "❌ ${backend_name} process exited before becoming reachable"
print_backend_log "$backend_name" "$log_file"
return 1
fi
}
check_backend_process() {
local backend_name=$1
local backend_pid=$2
local log_file=$3
if [ -n "$backend_pid" ] && ! kill -0 "$backend_pid" 2>/dev/null; then
echo "❌ ${backend_name} process exited before becoming reachable"
print_backend_log "$backend_name" "$log_file"
return 1
fi
return 0
}

@ruizhang0101 ruizhang0101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ruizhang0101
ruizhang0101 merged commit 75ba048 into vllm-project:main Aug 10, 2026
17 checks passed
@lfsun02
lfsun02 deleted the fix/router-e2e-cleanup-and-fail-fast branch August 10, 2026 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants