Skip to content

fix(port): change default port to 18080, handle Windows excluded TCP ranges#757

Open
livepeer-tessa wants to merge 1 commit intomainfrom
fix/windows-port-excluded-range
Open

fix(port): change default port to 18080, handle Windows excluded TCP ranges#757
livepeer-tessa wants to merge 1 commit intomainfrom
fix/windows-port-excluded-range

Conversation

@livepeer-tessa
Copy link
Copy Markdown
Contributor

Problem

Scope hangs at startup on Windows 11 with:

Failed to start server: Error: No available ports found after 5 attempts starting from 52178

Root cause: Port 52178 (and the 4 ports after it) can fall inside Windows 11's OS-reserved TCP excluded ranges. These ranges are not "in use" in the traditional sense — no process is bound there — but Windows prevents binding to them entirely. This is common on machines with certain hardware (RTX 5090 etc.) that registers port exclusions at the driver level.

You can check your machine's excluded ranges with:

netsh int ipv4 show excludedportrange protocol=tcp

The old findAvailablePort only tried 5 consecutive ports, which wasn't nearly enough to escape a wide exclusion block (e.g. 52085–52184).

Fix

  1. Change DEFAULT_PORT from 52178 to 18080 — sits well outside both the Windows dynamic ephemeral range (49152–65535) and known exclusion blocks near the high end
  2. Increase maxAttempts from 5 → 50 — more headroom for fallback
  3. Add jump-ahead logic — after 10 consecutive port failures, skip forward 200 ports to escape a wide OS-excluded block quickly, with a warning log
  4. Simplify isPortAvailable error handling — all socket errors (EADDRINUSE, EACCES, ENOBUFS, etc.) correctly return false

Testing

  • macOS/Linux: no change in behavior (18080 is available in standard configs)
  • Windows: no longer hits the excluded range on affected machines

Closes #606

…ge handling

Port 52178 can fall inside Windows 11's OS-reserved TCP excluded ranges
(visible via `netsh int ipv4 show excludedportrange protocol=tcp`), causing
Scope to hang at startup with 'No available ports found after 5 attempts'.

Changes:
- Change DEFAULT_PORT from 52178 to 18080, which sits well outside both the
  Windows dynamic port range (49152-65535) and known exclusion blocks
- Increase findAvailablePort maxAttempts from 5 to 50
- Add jump-ahead logic: after 10 consecutive failures, skip 200 ports to
  escape a wide OS-excluded block more quickly
- Simplify error handling in isPortAvailable (all errors = port unavailable)

Fixes #606, reported by @viborc and confirmed by @Tobe2d

Signed-off-by: livepeer-robot <robot@livepeer.org>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Important

Review skipped

Auto reviews are disabled on this repository. 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

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26e14b7d-0765-4023-b736-df5f9fc04541

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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/windows-port-excluded-range

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown
Contributor

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-757--preview
WebSocket wss://fal.run/daydream/scope-pr-757--preview/ws
Commit 945a274

Livepeer Runner

App ID daydream/scope-livepeer-pr-757--preview
WebSocket wss://fal.run/daydream/scope-livepeer-pr-757--preview/ws
Auth private

Testing

Connect to this preview deployment by running this on your branch:

uv run build && SCOPE_CLOUD_APP_ID="daydream/scope-pr-757--preview/ws" uv run daydream-scope

Livepeer mode:

SCOPE_CLOUD_MODE=livepeer SCOPE_CLOUD_APP_ID="daydream/scope-livepeer-pr-757--preview/ws" uv run daydream-scope

🧪 E2E tests will run automatically against this deployment.

@github-actions
Copy link
Copy Markdown
Contributor

✅ E2E Tests passed

Status passed
fal App daydream/scope-pr-757--preview
Run View logs

Test Artifacts

Check the workflow run for screenshots.

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.

Scope hangs on start on Windows 11 - ports issue and my workaround

1 participant