Skip to content

fix(ci): give falcon-hello a per-run port pair — fixed ports collide - #349

Merged
avrabe merged 1 commit into
mainfrom
fix/falcon-hello-port-collision
Aug 8, 2026
Merged

fix(ci): give falcon-hello a per-run port pair — fixed ports collide#349
avrabe merged 1 commit into
mainfrom
fix/falcon-hello-port-collision

Conversation

@avrabe

@avrabe avrabe commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

A red required check on a PR that could not have caused it.

Symptom

error: bind 127.0.0.1:14700: Address already in use (os error 98)
error: bind 127.0.0.1:14701: Address already in use (os error 98)

Hit on #342 — which changes one workflow file and cannot affect a UDP demo. main was green at the same commit range, so the failure was environmental.

Cause

falcon-hello binds a fixed UDP port pair (default 14700/14701). Several of these jobs can land on the same self-hosted runner concurrently. That is not a rare race: it happens whenever more than one PR is updated at once, which is routine here because branch protection is strict — every merge puts the remaining PRs BEHIND and they all get refreshed together. I triggered it by updating four PRs in one go.

Why fix rather than re-run

It presents as a genuine regression on an unrelated PR, so it costs a diagnosis cycle. And the thing that "works" is hitting re-run on a red gate — which is precisely the habit that gets a real failure clicked through.

Fix

scripts/falcon-hello-demo.sh already honours FALCON_HELLO_PORT_BASE (line 28). CI just never set it.

base = 20000 + (GITHUB_RUN_ID % 10000) * 2   ->  20000..39998
pair = base, base+1

Stepping by 2 is load-bearing — the demo uses base and base+1, so consecutive bases would still collide on one port.

GITHUB_RUN_ID is injected by Actions as a plain env var, so nothing is interpolated into the run: block.

Verified end-to-end, not by reading

$ FALCON_HELLO_PORT_BASE=20246 bash scripts/falcon-hello-demo.sh
[falcon-hello-demo] launching gcs on 127.0.0.1:20246
exit=0

Port range checked (20000–39999, valid), consecutive run ids confirmed 2 apart, YAML parses.

🤖 Generated with Claude Code

https://claude.ai/code/session_01HvusAXYbHLyv3uTzfBcMbG

The demo binds a FIXED UDP port pair (default 14700/14701). Several of these
jobs can land on the SAME self-hosted runner concurrently, and the second one
dies:

  error: bind 127.0.0.1:14700: Address already in use (os error 98)
  error: bind 127.0.0.1:14701: Address already in use (os error 98)

Observed 2026-08-08 after four PRs were refreshed together. It is not rare —
it happens whenever more than one PR is updated at once, which is routine when
branch protection is strict and every merge puts the rest BEHIND.

WHY IT IS WORTH FIXING RATHER THAN RE-RUNNING: it surfaces as a red REQUIRED
check on a PR that cannot possibly have caused it — #342 changed a single
workflow file — so it reads as a real regression and costs a diagnosis cycle.
Worse, the "fix" that works is hitting re-run, which is exactly the habit that
gets a genuine failure clicked through.

The script ALREADY honours FALCON_HELLO_PORT_BASE (scripts/falcon-hello-demo.sh
line 28). CI simply never set it. Derive a per-run base from GITHUB_RUN_ID.

Stepping by 2 is load-bearing: the demo uses base AND base+1, so consecutive
bases would still overlap on one port.

  base = 20000 + (GITHUB_RUN_ID % 10000) * 2   ->  20000..39998
  pair = base, base+1                          ->  20000/20001 .. 39998/39999
  consecutive run ids differ by 2 -> no shared port

GITHUB_RUN_ID is injected by Actions as a plain env var, so nothing is
interpolated into the run: block.

Verified locally end-to-end, not merely by reading the script:

  $ FALCON_HELLO_PORT_BASE=20246 bash scripts/falcon-hello-demo.sh
  [falcon-hello-demo] launching gcs on 127.0.0.1:20246
  exit=0

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HvusAXYbHLyv3uTzfBcMbG
@avrabe
avrabe enabled auto-merge (squash) August 8, 2026 06:30
@avrabe
avrabe merged commit d7f3b7d into main Aug 8, 2026
11 checks passed
@avrabe
avrabe deleted the fix/falcon-hello-port-collision branch August 8, 2026 06:50
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.

1 participant