Skip to content

CI: fix SGLang router port collision in sanity test - #1995

Merged
dpressle merged 1 commit into
ai-dynamo:mainfrom
dpressle:ci/sglang-router-port-collision
Jul 27, 2026
Merged

dpressle merged 1 commit into
ai-dynamo:mainfrom
dpressle:ci/sglang-router-port-collision

Conversation

@dpressle

@dpressle dpressle commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

get_next_tcp_port() checks ss -tuln at call time but does not bind the port, so PROXY_PORT allocated at startup (before the servers run) is vulnerable to a race: SGLang binds internal gRPC/ZMQ ports derived from its base port after startup, and one of those can land on PROXY_PORT before sglang_router tries to bind it. The router then exits immediately with "Address already in use", and the masked || true on the health wait lets the script limp on until the 120s request timeout fires.

Fix: re-allocate PROXY_PORT after both SGLang servers pass their health checks, so get_next_tcp_port() sees all internally-bound ports in ss -tuln and skips past them. Also remove the || true so a router startup failure surfaces immediately instead of 120s later.

Reported by the CI triage agent on PR #1987.

What?

Describe what this PR is doing.

Why?

Justification for the PR. If there is an existing issue/bug, please reference it. For
bug fixes, the 'Why?' and 'What?' can be merged into a single item.

How?

It is optional, but for complex PRs, please provide information about the design,
architecture, approach, etc.

Summary by CodeRabbit

  • Bug Fixes
    • Improved SGLang router startup by preventing port conflicts.
    • Added stricter router health checks so startup failures are detected reliably.

get_next_tcp_port() checks ss -tuln at call time but does not bind the
port, so PROXY_PORT allocated at startup (before the servers run) is
vulnerable to a race: SGLang binds internal gRPC/ZMQ ports derived from
its base port after startup, and one of those can land on PROXY_PORT
before sglang_router tries to bind it. The router then exits immediately
with "Address already in use", and the masked `|| true` on the health
wait lets the script limp on until the 120s request timeout fires.

Fix: re-allocate PROXY_PORT after both SGLang servers pass their health
checks, so get_next_tcp_port() sees all internally-bound ports in
ss -tuln and skips past them. Also remove the `|| true` so a router
startup failure surfaces immediately instead of 120s later.

Reported by the CI triage agent on PR ai-dynamo#1987.

Signed-off-by: Daniel Pressler <danielpr@nvidia.com>
@dpressle
dpressle requested a review from a team as a code owner July 27, 2026 06:57
@github-actions

Copy link
Copy Markdown

👋 Hi dpressle! Thank you for contributing to ai-dynamo/nixl.

Your PR reviewers will review your contribution then trigger the CI to test your changes.

🚀

@dpressle

Copy link
Copy Markdown
Contributor Author

/build

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The SGLang sanity script reallocates the proxy port after prefill/decode servers start, launches the router on that port, and treats router health-check failures as fatal.

Changes

SGLang sanity flow

Layer / File(s) Summary
Reallocate router port and enforce readiness
.gitlab/test_vllm_sglang_sanity.sh
The script selects a new PROXY_PORT after prefill/decode health checks, starts sglang_router with it, and removes the tolerated router health-check failure.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: aranadive

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the SGLang router port-collision fix in the CI sanity test.
Description check ✅ Passed The description explains the bug, the fix, and the rationale, covering What and Why with enough detail for this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitlab/test_vllm_sglang_sanity.sh:
- Line 160: Update get_next_tcp_port in common.sh to revalidate each candidate
after wrapping from tcp_port_max to tcp_port_min, continuing to scan for an
available port rather than returning an occupied one. If the entire configured
range is occupied, report port allocation exhaustion instead of returning a
colliding value; keep PROXY_PORT’s existing use unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 8ffe175d-8fc3-4432-b10d-4e95e0fe1f8d

📥 Commits

Reviewing files that changed from the base of the PR and between cdb4252 and 73832ed.

📒 Files selected for processing (1)
  • .gitlab/test_vllm_sglang_sanity.sh

Comment thread .gitlab/test_vllm_sglang_sanity.sh
@svc-nixl

Copy link
Copy Markdown
Collaborator

🤖 CI Triage Agentnixl-ci-dl-gpu-ep · commit 3587eca1

TL;DR: The build succeeded; the job failed because the salloc request for a gb200nvl72_cx8 SLURM node on dlcluster.nvidia.com could not be granted and the connection timed out — a cluster capacity/infra issue, not a code defect in PR #1995.

Full analysis

Summary: Stage "Allocate DL EP Environment" (#200) failed at salloc when requesting a GB200 GPU node; the UCX/NIXL compile stages all completed successfully.

Root cause: SLURM resource allocation on dlcluster.nvidia.com failed:
salloc: job 1667981 queued and waiting for resourcessalloc: error: Unable to allocate resources: Connection timed outscript returned exit code 1. The gb200nvl72_cx8 partition could not provide a node within the --immediate=3600 window, and the SSH/salloc connection timed out. This was preceded at 08:07 by a Jenkins agent channel drop (hudson.remoting.ChannelClosedException), indicating an infrastructure/cluster-availability problem rather than anything in the changed code. Note this is not a hang — the two salloc attempts show the process was actively waiting on the scheduler (job queued) and legitimately failed to get hardware.

Implicated commit: none — not caused by commit 3587eca or PR #1995. The failure is environmental (SLURM cluster capacity + Jenkins agent disconnect).

File: N/A — failure is in the Jenkins/SLURM allocation step (slurm.allocationsalloc -N 1 -p gb200nvl72_cx8 --immediate=3600 --time=01:30:00 --account=blackwell), not a repository source file.

Suggested fix: Retry the build — this is a transient infrastructure failure. If it recurs: (1) check gb200nvl72_cx8 partition availability/queue depth and the blackwell account's node quota on dlcluster.nvidia.com; (2) investigate why the Jenkins agent nixl-ci-dl-gpu-ep-buildhelperdlep-481... lost its channel at 08:07 (possible node eviction/OOM/network); (3) consider increasing --immediate tolerance or adding an automatic salloc retry/backoff in the allocation wrapper so a busy cluster doesn't hard-fail the PR. Do not treat this as a PR-1995 code regression.

Related: none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants