Skip to content

Embedded core cannot start on Windows when port 7788 is in an OS-excluded range, because the fallback ports 7789-7798 are in the same range #8621

Open

Description

@senamakel

Milestone: Nov 9 - Nov 13 · Parent: tinyhumansai/team#46

Sentry issues covered

2 Sentry issue(s), 300 events in total, up to 1 users on a single issue. Releases seen: 0.64.15.

Sentry Project Events Users Releases Last seen
TAURI-RUST-8CB tauri-rust 297 1 0.64.15 2026-11-01
TAURI-RUST-16V1 tauri-rust 3 1 0.64.15 2026-11-03

What happens

On Windows, Hyper-V / WinNAT / WSL2 / Docker reserve TCP port blocks (netsh interface ipv4 show excludedportrange). Binding 127.0.0.1:7788 fails with WSAEACCES (os error 10013). pick_listen_port_with_policy correctly treats this as an exclusion and tries the fallback pool, but the pool is 7789-7798, the ten ports right next to 7788. Reserved blocks are usually 50-100 ports wide, so the whole pool is excluded too, and the core gives up: "preferred core port 7788 is occupied by port excluded by OS (...); no fallback ports available in [7789..7798]". The app then has no core. TAURI-RUST-8CB: 297 events on 0.64.15 (one user keeps retrying); 16V1 is a second machine.

Likely code path

  • crates/openhuman-core/src/platform/connectivity/rpc.rs: DEFAULT_FALLBACK_START = 7789, DEFAULT_FALLBACK_END = 7798; pick_listen_port_for_host_with builds the pool; pick_listen_port_with_policy routes 10013 to pick_fallback_port; pick_fallback_port returns NoAvailablePort after the contiguous pool
  • crates/openhuman-app/src/core_process.rs: start-up path that reports the bind failure

Suggested fix

  • When the preferred port is OS-excluded (or the contiguous pool is exhausted), fall back to an OS-assigned port (bind(127.0.0.1:0)) and publish it through the existing ready signal (EmbeddedReadySignal.port / fallback_from), which the shell already honours.
  • Alternatively add a second pool far from 7788 (different 100-port block), but port 0 is the only choice that cannot collide with an exclusion.
  • Regression test: inject a binder that returns 10013 for 7788..=7798 and assert a port is still picked.

Done when

  • A regression test reproduces the failure (or the misreport) and passes with the fix
  • The fix is merged to main
  • The Sentry issues above are resolved in the next release, and stay quiet on builds that carry the fix

Activity

  1. added
    priority: p1
    on Nov 9, 2026
  2. tinysweeper commented on Nov 9, 2026

    @tinysweeper

    On Windows, the embedded core fails to start when the preferred port 7788 lies in an OS-reserved TCP exclusion range, because the fallback pool 7789-7798 sits immediately adjacent and is typically inside the same 50-100 port reserved block; the core then reports no available fallback port and the app gets no core. Suggested fix is falling back to an OS-assigned port (bind :0) published through the existing ready signal, plus a regression test injecting 10013 for 7788..=7798. Close to zero user impact (2 Sentry issues, ~1-2 users) but a hard start-up failure on affected Windows/Hyper-V machines with no workaround for those users, so p1; no candidate issue covers this port-exclusion failure, so no prior art.

    Labelled priority: p1.

  3. added theissue type on Nov 9, 2026
  4. M3gA-Mind commented on Nov 16, 2026

    @M3gA-Mind
    Collaborator

    Re-checked on current main (2b07daf): still present. The fallback pool is still 7789-7798, now in crates/openhuman-rpc/src/server/listen_port.rs (lines ~17-18, moved in #8723). pick_fallback_port (around 267-330) still gives up with NoAvailablePort when the whole contiguous range is excluded. There is no OS-assigned (port 0) last resort; serve.rs (~138-147) bails and core_process.rs (~379-406) returns the error.

    Next step: fall back to an OS-assigned port when the pool is exhausted (the app already reads the bound port back), plus a test with a simulated excluded range.

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

Metadata

Metadata

Assignees

Labels

bugpriority: p1

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions