Skip to content

1.12.4#342

Merged
oschwartz10612 merged 10 commits into
mainfrom
dev
May 8, 2026
Merged

1.12.4#342
oschwartz10612 merged 10 commits into
mainfrom
dev

Conversation

@oschwartz10612

@oschwartz10612 oschwartz10612 commented May 8, 2026

Copy link
Copy Markdown
Member
  • Fix incorrect redirect logic
  • Update status code
  • Try to fix failover not working
  • Fix not logging when rewriting nat
  • Attempt to fix nix issue
  • Bump version
  • fix(ping): decouple data-plane recovery trigger from backoff ramp
  • Increase max attempts
  • Retry interval while we are disconnected

Fixes #284

oschwartz10612 and others added 10 commits April 29, 2026 21:11
The trigger condition that decides whether to fire the data-plane
recovery flow in startPingCheck was AND-ed with `currentInterval <
maxInterval`. That clause was meant to throttle the *backoff ramp*
(don't widen the interval past 6s), but it also gated the recovery
trigger itself — a conflation that became invisibly load-bearing
once commit 8161fa6 (March 2026) bumped the default pingInterval
from 3s to 15s while leaving maxInterval at 6s. Under the new
defaults `currentInterval` starts at 15s and `15 < 6` is permanently
false, so the recovery branch never executed. Pings just kept
failing and the failure counter climbed forever, with no
"Connection to server lost" log line and no newt/ping/request
emitted on the websocket. Real-world recovery only happened when
the underlying network came back fast enough that a periodic ping
naturally succeeded again — which doesn't happen if the WireGuard
state on either end has rotated, so users were left stuck until
they restarted newt.

This is the proximate cause of the user reports in
#284 (and dups #310, fosrl/pangolin#1004). Logs in
those issues all show ping-failure counters growing without ever
emitting "Connection to server lost", which is exactly the
fingerprint of this gate being false.

The fix is to extract the trigger decision into shouldFireRecovery
and remove currentInterval from it. Backoff is now computed in a
separate `if` in the caller, still gated by `currentInterval <
maxInterval` so the ramp is a no-op under default settings (which
is the existing behaviour, just no longer entangled with the
recovery trigger). Fixing the backoff ramp itself — making it
useful when pingInterval >= maxInterval — is a follow-up: the
priority is restoring recovery, not improving the dampening
schedule.

The new shouldFireRecovery helper is unit-tested. Its signature
intentionally omits currentInterval, so a future refactor that
re-introduces the interval-dependent gate would need to change
the function signature, which makes the historical bug harder
to reintroduce silently.
@oschwartz10612 oschwartz10612 merged commit 542c70b into main May 8, 2026
12 checks passed
mrkhachaturov pushed a commit to mrkhachaturov/newt that referenced this pull request Jun 15, 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.

Newt loses connection to server and will only reconnect on service restart

4 participants