android-client icon indicating copy to clipboard operation
android-client copied to clipboard

0.6.0 stops reconnecting after a network blip; stuck at "Connecting" until manual toggle

Open jtklinger opened this issue 2 months ago • 9 comments

Device: Pixel 10, Android 16, NetBird app 0.6.0 (engine 0.78.0), self-hosted management 0.79.0 Debug bundle upload key: 5818509ad8ba6992987910b78ae018e2689e598caf964d12696c5bc983b6998f/ca11733c-94b9-4605-ac42-3ac09e9d6ad2

Symptom The client drops and then shows "Connecting" indefinitely. Only disconnect/connect in the app recovers it. Four occurrences in three days, most recently twice in one afternoon.

What the server sees Relay: solo "peer healthcheck timeout" for this peer, then a 30-60 min gap before "peer connected". Last occurrence was different: relay logged "failed to read message: EOF" (clean close from the phone) and management logged "recv job response error: context canceled" 13 s later. No other peer dropped. Wi-Fi stayed associated to the same SSID throughout (verified on the controller).

What the phone's logcat shows During a 35-minute stuck window the engine emitted zero lines: no management, signal, or relay reconnect attempts and no ICE activity. The process was alive (same PID before and after the toggle). The first engine line after the toggle was: guard/ice_retry_state.go:52 ICE retries exhausted (3/3), switching to hourly retry So the engine appears to burn its three retries during the blip and then park for an hour, even though the network is back within seconds.

Earlier occurrences were triggered by a weak-signal Wi-Fi roam (-77 dBm). After enabling 802.11r and lowering that AP's power, the phone roamed cleanly and NetBird stayed P2P, but the last occurrence happened with no roam at all.

Related: #146, #181, netbirdio/netbird#2029

jtklinger avatar Sep 22 '26 20:09 jtklinger

Confirming. Same issue on Galaxy S25 with Android 16. Turning off Wifi (which switches to mobile net) while VPN is on forces client to stay in "Connecting..." indefinitely. Since I use my home Pi-hole for DNS, I effectively lose Internet connectivity.

ddenev avatar Sep 24 '26 16:09 ddenev

I am experiencing this same issue on my Galaxy S25 with Android 16. I'm on the latest release of the app 0.6.1 and I'm running server version 0.80.0. I generated a debug bundle, my key is 7f963badadef3935d752df750513d1d6918bcbabcb53106fd2a019548902c32d/4c8ec13e-ea82-4e51-82ed-0dedea39e7ce

Tylan avatar Oct 06 '26 10:10 Tylan

+1, same issue on Pixel 9 Pro, NetBird app 0.6.1, NetBird Cloud management.

Repro: phone on Wi-Fi with an active relayed connection to a macOS peer (v0.79.0, lazy connections disabled account-wide). Turn off Wi-Fi so the phone moves to mobile data. Do not touch the app.

Observed from the macOS peer (sampled every 5s):

  • t+0s: ping to the phone fails immediately after the switch. Last WireGuard handshake was before the switch.
  • t+60s: the peer status changes from Connected/Relayed to Connecting.
  • t+9.5min: still Connecting, no handshake, 0 B received. Never recovers on its own.

A manual disconnect/connect in the Android app restores it right away, every time.

nadavl avatar Oct 08 '26 17:10 nadavl

2 phones having the same issue.

v0.6.1 on phone v0.80.0 selfhosted server S25 Ultra Android 17 and Android 16

With your vpn connected, switch on or off wifi, or leave wifi range and move to cellular. Device will stay "connecting" until you manually turn the tunnel off and then back on where it immediately connects.

tkacys avatar Oct 12 '26 22:10 tkacys

I hit this on a Pixel 10 (Android 16, app 0.6.1, engine 0.78.0, self-hosted 0.80.0 server) and traced one concrete cause on the device. Posting it here because it may explain some of the reports in this thread, and there is a one-setting workaround to test.

Root cause on my device: Android Private DNS in strict mode.

With Private DNS set to a hostname (I use a ControlD hostname), Android sends every DNS query from every process, including the NetBird engine's own getaddrinfo calls, as DNS over TLS to that hostname. With the tunnel up and a default route through it, that DoT traffic is routed through the tunnel. The sequence after a network blip is then:

  1. Peers drop and the engine needs to redial signal and relay.
  2. To redial it has to resolve the management hostname.
  3. The resolution goes to the Private DNS server through the tunnel that just died.
  4. The lookup never returns, so the engine never redials. The management stream often survives, so the app may show "Connected" while every peer is gone, or sit at "Connecting" indefinitely.

Proof: with the engine stuck for 45 minutes, I switched Private DNS to Automatic over adb (settings put global private_dns_mode opportunistic). The engine recovered on its own within 75 seconds, no toggle. In Automatic mode the engine's lookups go to the tunnel's own DNS address, which is the engine's in-process resolver, and that forwards upstream over VPN-protected sockets, so it keeps working while the tunnel is down.

Workaround for anyone affected: Settings > Network & internet > Private DNS > Automatic (or Off). If your phone stops getting stuck after that, you have the same cause. If it still gets stuck with Private DNS off, your case is something else and this comment does not cover it.

Fix: I patched the engine so that on Android it installs a net.DefaultResolver that dials the underlying network's DNS servers over protected sockets, independent of the Private DNS setting. I have run it for eight days with strict Private DNS re-enabled, across daily Wi-Fi/cellular roaming; every drop recovered within two minutes without intervention. PR: https://github.com/netbirdio/netbird/pull/8246 (engine side only; no app change needed).

For other reporters here: could you say whether Private DNS is set to a hostname on the affected phone? Samsung and Pixel both use strict mode as soon as a hostname is entered.

jtklinger avatar Oct 18 '26 21:10 jtklinger

Both of my phones have it set to, Off.

tkacys avatar Oct 18 '26 21:10 tkacys

Samsung Galaxy S25 Ultra - my Private DNS is set to Off

ddenev avatar Oct 20 '26 05:10 ddenev

Setting the Private DNS to Off or Automatic is not the fix for me. I was already set to Automatic.

Tylan avatar Oct 20 '26 20:10 Tylan

Samsung Galaxy S25 Ultra, v0.6.1, Private DNS set to Off.

alexbunt avatar Oct 22 '26 10:10 alexbunt