Skip to content

feat(iroh): skip undeliverable net_report probes on wasm32-wasip2 - #3

Open
lann wants to merge 1 commit into
mainfrom
wasi-net-report-probes
Open

feat(iroh): skip undeliverable net_report probes on wasm32-wasip2#3
lann wants to merge 1 commit into
mainfrom
wasi-net-report-probes

Conversation

@lann

@lann lann commented Aug 7, 2026

Copy link
Copy Markdown
Owner

On wasi components the relay leg is a host-side websocket pipe, so two probe classes can never complete and only burn PROBES_TIMEOUT, stalling the report — and home-relay selection and Endpoint::online() behind it:

  • HTTPS probes: no HTTP client path exists (reqwest has no wasip2 backend). Return a nominal latency so home-relay selection proceeds; the relay's actual reachability is proven by the relay dial itself.
  • QAD probes: ride UDP straight to the relay's QUIC socket, which the host cannot deliver. Skip them; external addresses arrive through Endpoint::add_external_addr instead, so nothing consumed the probe results anyway.

Measured effect (join latency, polymorph-components/polymorph-iroh#25): report completion ~3.2s → ~200ms.

Known cost of the nominal-latency form: every relay ties, so home-relay selection among a multi-relay map is no longer latency-driven. The upstream-shaped fix is probably a probe-capability gate ("this target cannot run this probe class") plus treating relay-dial success as reachability — flagged for design discussion rather than baked in here.

Siblings: the iroh-dns resolver-config fallback and the relay datagram-pipe seam. Merged together into the long-lived polymorph-iroh branch that the component experiments consume.

On wasi components the relay leg is a host-side websocket pipe, so two
probe classes can never complete and only burn PROBES_TIMEOUT:

- HTTPS probes have no HTTP client path. Return a nominal latency so
  home-relay selection proceeds; the relay's actual reachability is
  proven by the relay dial itself.
- QAD probes ride UDP straight to the relay's QUIC socket, which the
  host cannot deliver. Skip them; external addresses arrive through
  `Endpoint::add_external_addr` instead.

Without this the report stalls for the full probe timeout and
home-relay selection and `Endpoint::online` stall behind it.

Part of running iroh on wasm32-wasip2 components
(polymorph-components/polymorph-iroh#25).
@lann

lann commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

Upstream-shape note for the QAD half, found while evaluating shim-side QAD termination: upstream already gates QAD on transport capability — socket.rs:1041:

// Set a `QuicConfig` for address discovery (QAD), but only if we have IP transports.
//
// If there are no IP transports configured, then we don't set a QuicConfig.
// If we would, the `noq::Endpoint` passed along will not have IP connectivity,
// and the QAD probes that connect to the relay's QUIC endpoints would time out
// because all outgoing packets to IP destinations would be dropped.
let qad_config = has_ip_transports.then(|| QuicConfig { ... });

Same rationale as this PR, in upstream's own words. The synthetic-address overlay defeats the gate by construction: the endpoint does have IP transports (that's the point of the overlay), they just can't reach the relay's QUIC socket. So the upstream conversation for this probe class is better framed as "the existing gate keys on the wrong predicate — has_ip_transports is not can reach relays over UDP; expose or refine it (e.g. a builder knob or per-relay-map capability)" rather than a wasi cfg.

Also noting for completeness: shim-side QAD termination was evaluated and rejected — it needs a full QUIC+TLS1.3 server with the address-discovery extension in every host, a shim-minted cert (guest could trust it via the public CaTlsConfig::custom_roots, no patch — but that is key synthesis wearing the relay's name), and it would report shim-RTT (as fictional as the nominal HTTPS latency) plus an address the bridge already injects via add_external_addr, event-driven and faster. Fail-fast via shim send-errors also doesn't work: noq swallows transient send errors and PTO-retransmits until PROBES_TIMEOUT.

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