Skip to content

fix(core): retry stalled ICE DNS lookups and report dropped ICE servers - #624

Merged
akirilyuk merged 3 commits into
mainfrom
fix/ice-resolve-stall
Nov 25, 2026
Merged

akirilyuk merged 3 commits into
mainfrom
fix/ice-resolve-stall

Conversation

@akirilyuk

@akirilyuk akirilyuk commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Why

resolve_ice_servers drops a STUN/TURN url whose DNS lookup misses the 2 s bound. One lost UDP DNS packet was enough, and the failure was negative-cached for 30 s process-wide, so every peer connection in that process lost the server. The drop was only reported through log::warn!, which no consumer installs. A peer that lost its only public STUN server failed every ICE pair with nothing in the logs.

Change

  • Anything but an explicit no-such-name answer (EAI_NONAME / EAI_NODATA texts from glibc, musl and macOS) gets one more lookup with a fresh bound (worst case 2 x 2 s): timeouts, EAI_AGAIN (musl: "Try again") and unrecognised resolver errors. An explicit no-such-name answer is not retried.
  • Only resolved results and explicit no-such-name answers are cached. Every other failure is not, so the next connection looks the host up again.
  • Each dropped url is written to stderr (always on) and log::warn!. Notices name the url only; credentials are separate fields.
  • The 2 s bound is unchanged.

Tests (paused clock, scripted resolver)

  • stall then ok: url kept, 2 attempts
  • transient error then ok: url kept, 2 attempts
  • stall twice: dropped, one notice, 2 attempts, 4 s
  • NXDOMAIN: 1 attempt, dropped, cached
  • musl "Try again" then ok: url kept, 2 attempts, not cached
  • unrecognised resolver error then ok: url kept, 2 attempts
  • musl "Name does not resolve": 1 attempt, dropped, cached
  • timeout: not cached, so the next resolve looks up again
  • resolved and literal urls yield no notice

Test plan

Verified locally and via CI; no extra manual steps.

resolve_ice_servers drops a STUN/TURN url whose DNS lookup misses the 2 s bound, but only said so through log::warn, which no consumer installs, so a peer that lost its only public STUN server failed every pair with no trace. Collect one notice per dropped url (resolve_with_notices) and write it to stderr and log::warn. Tests: a stalled resolver yields exactly one notice naming the url; resolved and literal urls yield none.
…ient failures

A single lost UDP DNS packet made resolve_ice_servers drop the STUN/TURN url and negative-cache it for 30 s, so every peer connection in the process lost that server. On staging that removed the runner's only public STUN server and failed every ICE pair.

A timeout or transient resolver error (EAI_AGAIN, timeout-like io kinds) now gets one more lookup with a fresh bound (worst case 2 x 2 s). NXDOMAIN and other definitive answers are not retried and stay negative-cached; transient failures are not cached, so the next connection looks the host up again.

Tests (paused clock, scripted resolver): stall then ok keeps the url after 2 attempts; transient error then ok keeps it; stall twice drops it with one notice after 2 attempts and 4 s; NXDOMAIN is 1 attempt and cached; a timeout is not cached and the next resolve looks up again.
@akirilyuk akirilyuk changed the title fix(core): report dropped ICE servers on stderr fix(core): retry stalled ICE DNS lookups and report dropped ICE servers Nov 25, 2026
… answer

musl reports EAI_AGAIN as 'Try again', which the old message check treated
as definitive and cached for 30 s. Classify only EAI_NONAME/EAI_NODATA texts
(glibc, musl, macOS) as definitive; any other error is retried once and not
cached.
@akirilyuk
akirilyuk merged commit 0c52982 into main Nov 25, 2026
9 checks passed
@akirilyuk
akirilyuk deleted the fix/ice-resolve-stall branch November 25, 2026 15:32
@akirilyuk akirilyuk mentioned this pull request Nov 25, 2026
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