Skip to content

macOS (macsys 1.98.8): magicsock ReceiveIPv4 stops after boot and never retries — control plane stays up and masks it; only an app quit/relaunch recovers (down/up and pkill do not) #20616

Closed

Description

@jmfoster

What happened

After a clean reboot, this Mac was unreachable over Tailscale for about two hours until I recovered it with physical access. Throughout, the node reported itself healthy: BackendState: Running, Self.Online: true, and a full peer list, while it could not receive a packet.

Up front about the evidence: I have the observed state during the outage, but not the daemon logs explaining why the receive loop stopped — see "The evidence I could not collect" below, which is itself a reportable problem. I have since put a local watchdog in place that captures state at the moment of recurrence, so I can supply better data next time.

Health output during the outage

# Health check:
#     - Tailscale could not connect to the 'Chicago' relay server. Your Internet
#       connection might be down, or the server might be temporarily unavailable.
#     - The MagicSock function ReceiveIPv4 is not running. You might experience
#       connectivity issues.

Both were present together, which is presumably why this was a total outage rather than a fallback to relay.

The network itself was fine

tailscale netcheck, run during the outage, was healthy — including the relay named in the warning:

* UDP: true
* IPv4: yes, <redacted>:49971
* MappingVariesByDestIP: false
* PortMapping: UPnP, NAT-PMP
* Nearest DERP: Chicago
* DERP latency:
    - ord: 41.7ms  (Chicago)
    - nyc: 48.1ms
    - iad: 62.9ms
      [full map responded]

So the STUN/UDP probe reached Chicago at 41.7 ms while the persistent DERP connection was reported down.

Observed vs. inferred

I want to be careful to separate these.

Observed. During the same window, netcheck logged:

portmap: monitor: gateway and self IP changed: gw=<lan-gateway> self=<lan-address>

The extension had been running since boot (PPID 1, uptime matching the boot time), and the machine had reached a logged-in session within the same minute as the reboot.

Inferred, not proven. That the receive loop died because the extension initialized before the primary interface had its address. I do not have a log line showing ReceiveIPv4 exiting, nor the error it exited with, so I cannot rule out that it died later for an unrelated reason. What I can say is that it was down for the entire ~2h window and never retried on its own, and that this followed a boot.

The evidence I could not collect — possibly worth fixing on its own

I tried to recover the daemon logs afterward and could not. On this variant:

  • /Library/Tailscale/ipn.log..log1.txt and ipn.log..log2.txt are zero bytes; they appear to be truncated when the extension restarts — which is exactly what recovery requires.
  • Nothing from Tailscale appears in the macOS unified log for the window (log show --predicate 'process CONTAINS[c] "tailscale"' returns no entries).
  • tailscale debug daemon-logs is a live tap, not history.

The practical consequence is that any extension-side failure on macsys is undiagnosable after the fact unless someone catches it live — and this particular failure makes the machine unreachable, so catching it live is exactly what a remote operator cannot do. If persisted local logs survived an extension restart, this report would have had a cause in it.

What does NOT recover it

Both verified on the affected machine:

  1. tailscale down && tailscale up — insufficient. It recreates the tunnel interface (the tailnet address goes from bound on nothing to bound on a utun) but leaves the dead receive loop in place. The health warning persisted and pings still timed out.

  2. pkill -x Tailscale then open -a Tailscale — insufficient, and a trap for anyone scripting recovery. It terminates the GUI, but the network system extension survives, so the wedged magicsock is untouched. Measured twice, minutes apart, from an identical baseline:

    action extension PID
    pkill -x Tailscale + open -a Tailscale 9401 → 9401 (survives)
    osascript -e 'tell application "Tailscale" to quit' + open -a Tailscale 9401 → 25698 (replaced)

What does recover it

Quitting the app through its normal shutdown path (Cmd-Q, or the equivalent Apple Event) tears down and respawns the system extension, and the receive loop comes back. Health goes clean and peers reconnect immediately:

100.x.x.x  <peer-phone>  ...  active; direct <lan-address>:41641, tx 120147420 rx 460324

I have reproduced the quit/relaunch recovery four times since, each time confirming the extension PID changes.

Suggested directions

  1. Retry the rebind when a receive function is observed down. The health tracker already knows the goroutine has exited — recovery currently requires an out-of-band process restart for a condition the client has already detected and named.
  2. Rebind on interface-address arrival. The portmap monitor observed self IP changed; if magicsock rebound on that transition, a boot-ordering race would self-heal regardless of whether that is the trigger here.
  3. Persist local logs across extension restarts (see above) so this class is diagnosable at all on macsys.

Environment

  • macOS 26.5.2 (25F84), Darwin 25.5.0, Apple Silicon Mac mini
  • Tailscale 1.98.8, standalone/macsys variant (io.tailscale.ipn.macsys), 1.98.8-t1241b225b-g0520dfda5, go1.26.3
  • Network extension: /Library/SystemExtensions/<uuid>/io.tailscale.ipn.macsys.network-extension.systemextension
  • No tailscaled system daemon; the extension is activated by the GUI app
  • Used almost entirely remotely, so this is a hard outage rather than an annoyance

Related

Same symptom class, different platform and trigger: #19504 (iOS — "MagicSock ReceiveIPv4 goroutine stops, data plane dies while control plane stays up"). Also #10976 (Windows, open since Jan 2024) and #13322 (ReceiveDERP).

Happy to run a specific diagnostic matrix, or to attach a tailscale bugreport from the next occurrence — my watchdog now captures local state at the moment the warnable fires, so I should be able to provide a much better-evidenced follow-up.

Activity

  1. croakerbcts commented on Jul 27, 2026

    @croakerbcts
    Contributor
  2. added
    OS-macos
    on Jul 27, 2026
  3. added theissue type on Jul 27, 2026
  4. added
    connectivity
    bug
    on Jul 27, 2026
  5. bcreane commented on Aug 8, 2026

    @bcreane
    Contributor

    The receive goroutine is owned by wireguard-go, and it exits permanently on the first error it considers non-temporary. In Device.RoutineReceiveIncoming receive.go

    count, err = recv(bufs, sizes, endpoints)
    if err != nil {
        if errors.Is(err, net.ErrClosed) { return }
        device.log.Verbosef("Failed to receive %s packet: %v", recvName, err)
        if neterr, ok := err.(net.Error); ok && !neterr.Temporary() { return }   // <-- exits here
        ...

    Nothing restarts the goroutine afterwards. Same class as #19504 (iOS), #10976 (Windows) and #13322 (ReceiveDERP) - shared wgengine code rather than anything macOS-specific.

    The evidence: magicsock logs Receive func %s exiting with error: %T, %v on the way out, so the concrete errno for your outage window is likely already in this node's uploaded logs. A bug report ID per @croakerbcts's request above would let us confirm which one rather than infer it.

  6. jmfoster commented on Aug 9, 2026

    @jmfoster
    Author

    Unfortunately I can't produce a bug report ID for this one.

    Within a day of filing it I migrated this machine off the macsys build onto the
    open-source tailscaled running as a root LaunchDaemon, largely because of point 3
    above. The node was re-registered in the process and is now on 1.102.2, so a bugreport
    generated today marks a different node's log stream and would contain nothing from the
    outage window. The old logtail ID isn't recoverable locally either — the current
    tailscaled.log.conf was created at the migration, and what's left of the macsys spool
    is only its own shutdown lines.

  7. NichCodes commented on Sep 3, 2026

    @NichCodes

    Having the same issue on MacOS with MagicSock and ReceiveIPv4 and wanted to throw in my two cents. (And bug report ID for @croakerbcts, if it helps.)

    What I think is happening is that, after a network interface transition (like switching WiFI networks in my case), MagicSock gets stuck in a broken-pipe loop trying to reach peer endpoints on the previous network's local subnet. Recovery keeps on going for several minutes, during which the health check keeps showing the same error:

    The MagicSock function ReceiveIPv4 is not running. You might experience connectivity issues.
    Code: magicsock-receive-func-error
    Magicsock Function Name: ReceiveIPv4

    The logs kicked up over 800 lines of stuff, so I tossed it into all into convenient LLM to ask it to summarize (but I've uploaded the full bug report with --diagnostics if you wanna look at the details):

    SetNetworkUp(false) fires on disconnect, then when reconnecting to another physical network about half an hour later with SetNetworkUp(true) on reconnect. Immediately after, disco pings to peers fail with sendto: broken pipe against stale local-network addresses from the old network (e.g. 192.168.x.x). Tailscale attempts performing rebind due to "broken-pipe", but most attempts are suppressed by not performing "broken-pipe" rebind due to throttle, since new broken-pipe errors arrive faster than the rebind throttle allows. Traffic falls back to DERP relay and keeps re-negotiating (new contact: peer=... via=derp every 2-3s) well past the point it should have settled, with the health warning staying up throughout.

    Other Details

    How to Reproduce Bug

    1. Connect to a Wi-Fi network, let Tailscale establish direct/DERP connections to peers.
    2. Switch to a different network (different Wi-Fi network, etc.).
    3. Watch Console.app or log show for magicsock events — observe repeated broken pipe errors and a magicsock-receive-func-error health warning that persists for several minutes.

    OS version

    macOS 26.6

    Tailscale version

    $ tailscale version
    
    1.102.3
      tailscale commit: 9329c3677031109ff6d0b80abee0cddc8f35ff6f
      long version: 1.102.3-t9329c3677-ga522f65e9
      other commit: a522f65e92d54b594fe72e842afc9572bd9cf0b8
      go version: go1.26.6 (tailscale/go 7275f792d4)

    Bug Report ID

    BUG-66ff4025c2ac45ae1642ea11d1362c75449a6de214ffa46216d3ebe7e0ec887f-20260903221359Z-ad68545606af63af

  8. madeinoz67 commented on Sep 4, 2026

    @madeinoz67

    Same signature on the App Store variant (io.tailscale.ipn.macos) at 1.102.3, adding a few data points to this thread. macOS 26.x (Darwin 25.6.0), Apple Silicon.

    Trigger context differs from yours: not after boot. This incident began with the GUI app hung and the NE session stuck (scutil --nc showed the config in Connecting/Disconnecting with ConnectCount: 1, ConnectedCount: 0; the packet-tunnel extension was not running at all). After unwedging the session and relaunching the app, the tunnel came up nominally: peer listed active; direct, and tailscale ping ponged at 17–20 ms — while everything inside the tunnel was dead:

    $ tailscale ping -c1 <peer>
    pong from <peer> via <peer-public-endpoint> in 19ms
    
    $ tailscale ping --tsmp -c2 <peer>
    ping "<peer-ip>" timed out — no reply
    
    $ tailscale ping --icmp -c2 <peer>
    no reply
    
    peer line: active; direct <endpoint>, tx 8892 rx 0
    

    TCP to the peer's tailnet address and to hosts behind its advertised subnet routes: connection timeouts. tailscale netcheck healthy (UDP true, IPv4 yes, low DERP latency).

    What did not recover it — matches your findings:

    1. tailscale down && tailscale up — insufficient. After one cycle the peer's rx counter moved 0 → ~2.4 KB, but TSMP and all TCP flows stayed dead (~2 h total from onset).
    2. killall Tailscale alone leaves the network extension untouched — confirmed, same extension PID before and after.

    What recovered it: tailscale down → killall Tailscale → open -a Tailscale → tailscale up. Immediately after: TSMP pong 21 ms, TCP to the peer and to subnet-route targets succeeded, peer counters tx 332 KB / rx 1.8 MB and climbing. I can't isolate which component of the sequence mattered (the down before the kill, the extension respawn, or the up) — only that down/up without the GUI kill in between did not.

    Third-party filters exonerated by experiment: this machine runs Little Snitch 6.4.1 (network + endpoint-security system extensions) alongside a PIA split-tunnel network extension. Both were active at failure and at recovery — full function was re-verified with filtering re-enabled after the fix. Worth ruling out explicitly since content filters are the obvious first suspect here, and structurally: disco pongs and encrypted payload ride the same UDP 5-tuple from the same process, so a flow-based filter that allows the pong cannot selectively drop the payload inside that flow.

    Peer-side exonerated: a phone on the same tailnet (on cellular) could reach the affected Linux peer and its subnet routes throughout the outage — consistent with the failure living in the Mac's local receive path, not the peer or relay fallback.

    A cheap discriminator for anyone hitting this: tailscale ping (disco) vs tailscale ping --tsmp vs the peer's tx/rx counters in tailscale status. Disco pong + TSMP timeout + peer rx pinned at 0 while tx climbs isolates the failure to the in-tunnel data path while every layer above it reports healthy. A second tailnet device is the fastest way to exonerate the peer, but the TSMP/rx split alone already narrows it.

    Same evidence gap as yours, I'm afraid: no tailscale bugreport from before recovery, and nothing in the unified log exposing the receive-loop state during the outage (I have the extension's early os_log lines from the initial NE wedge, but nothing diagnostic from the data-plane-dead window). A watchdog now captures state at the moment of recurrence, so a better-evidenced follow-up is possible if it repeats.

  9. nikitistik commented on Sep 15, 2026

    @nikitistik

    I hit this roughly once a day on macOS and I think I have the mechanism, so here it is in case it helps, plus a proposed fix I would like a sanity check on before opening a PR.

    Setup: Tailscale 1.102.4 (App Store / macsys build), macOS 27.0, Apple silicon, with Proton VPN (WireGuard, its own utun) installed and Tailscale excluded from it. The deaths line up with Proton connect/disconnect transitions, i.e. the default route moving between en0 and Proton's utun, usually around sleep/wake. My watchdog log has 60 occurrences over 25 days; the only thing that recovers it is restarting the network extension (scutil --nc stop/start Tailscale). tailscale down && tailscale up does not, matching the report above. I do not yet have the exact errno from the extension's log (it is not kept), I have a tailscale debug daemon-logs tap running now and will add the "Receive func ReceiveIPv4 exiting with error: ..." line from the next occurrence.

    Why it never comes back (v1.102.4):

    • wgengine/magicsock mkReceiveFunc returns every read error other than truncation to wireguard-go.
    • wireguard-go device/receive.go RoutineReceiveIncoming (around L116-132 in the pinned tailscale/wireguard-go) returns permanently on any error that is not a Temporary() net.Error. On Darwin that is essentially every errno except EINTR/EMFILE/ENFILE/timeout.
    • Nothing recreates that goroutine afterwards. Device.Up (the only caller of BindUpdate) runs once at engine construction in wgengine/userspace.go; Rebind() from the link-change path only swaps the socket inside RebindingUDPConn, and a reader that has already returned never reads the new one. connBind is single-use by design, so BindUpdate would not work either.
    • The health warnable is stats-based (health.checkReceiveFuncsLocked, sampled every minute), so "is not running" literally means wireguard-go stopped calling the func. It has no remedy.

    Proposed fix: treat a non-shutdown read error inside the receive func the way the send path already treats EPIPE/ENOTCONN (maybeRebindOnError, from #14551): log once, do a throttled Rebind()+ReSTUN(), back off (100ms doubling to 5s) and keep reading. The func returns net.ErrClosed only when the Conn or the Bind is closed, so the conn.Bind contract and Device.Close's wait on the receive goroutines are unchanged, and closing the Bind wakes a func waiting out a backoff. Rebinds per error burst are bounded (throttled attempts are not charged) so one persistently broken address family cannot keep resetting every peer's endpoints, and Rebind/bindSocket no longer install a socket once Close has started. Two clientmetrics count the errors and the rebinds. The change is about 160 lines in magicsock.go plus tests (survive a read error and keep delivering from the rebound socket; return promptly when the Bind closes during a backoff or mid-read; no rebind after close; bounded rebinds). The package passes under -race. Branch: https://github.com/nikitistik/tailscale/tree/magicsock-receive-rebind

    Two questions before I send it as a PR: is retry-in-place in the receive func the layer you would want this at, or would you rather see wireguard-go's RoutineReceiveIncoming keep going / a BindUpdate path? And should the persistent-error case eventually raise its own warnable, since during the backoff inCall stays true and the existing "not running" warnable can no longer fire?

  10. nikitistik commented on Sep 19, 2026

    @nikitistik

    Opened #21396 with the change described above, rebased on current main.

  11. te316 commented on Sep 28, 2026

    @te316

    Adding a fast, reliable reproduction on macOS 27.2: with a Mullvad exit node, the receive func dies within 3 to 6 minutes, every time.

    Environment

    • macOS 27.2 (26B5091g), Apple silicon, home Wi-Fi (en0), IPv4 only (tailscale netcheck: UDP true, IPv6 no, nearest DERP iad)
    • Tailscale macsys 1.102.4 and 1.103.310 (unstable): both fail
    • Mullvad exit nodes via the Tailscale Mullvad add-on
    • Exit nodes worked reliably before the macOS 27 upgrade (2026-09-05)

    Symptom
    Everything works for 3.5 to 5.5 minutes, then all traffic stops at once (web, MagicDNS, and DNS sent directly to 1.1.1.1). The exit node peer's RxBytes freezes while TxBytes keeps rising. Health then shows The MagicSock function ReceiveIPv4 is not running (1.102.4) or ReceiveIPv6 is not running (1.103.310; in one run ReceiveIPv6 was reported about 1.5 minutes before traffic stopped). Turning the exit node off restores connectivity, but the receiver stays dead (Rx counter frozen, warning remains) until the app is quit and relaunched, matching this issue.

    Runs (each from a freshly relaunched app)

    Build Other network extensions Exit node Failed after Rx at failure
    1.102.4 Norton (firewall on) us-qas-wg-201 ~3.5 min 40.5 MB
    1.103.310 Norton (firewall on) us-qas-wg-201 ~4 min 67.3 MB
    1.103.310 Norton (firewall off) us-qas-wg-305 ~3.5 min 45.9 MB
    1.103.310 Norton (firewall off) us-nyc-wg-001 ~5.5 min 52.8 MB

    It also still fails with Norton and NordVPN uninstalled (their system extensions terminated), leaving Tailscale's as the only network extension. So this does not need a third-party VPN or route flip to trigger; the exit node traffic alone is enough.

    Bug reports, each captured at the moment of failure. The exact Receive func ... exiting with error line should be in the uploaded logs:

    • BUG-5c3774150a998758b6ac94d4b1a7e663c5da0543f2d464d3c935d20ca378ec6a-20260928163735Z-5b72318e2cfe9cd7
    • BUG-5c3774150a998758b6ac94d4b1a7e663c5da0543f2d464d3c935d20ca378ec6a-20260928164731Z-b5bdf689057bfbe1
    • BUG-5c3774150a998758b6ac94d4b1a7e663c5da0543f2d464d3c935d20ca378ec6a-20260928165528Z-f0099705f18f40b8

    Since it reproduces in minutes, I'm happy to test a build with #21396 (or any other candidate fix) and report back.

  12. 5 remaining items

  13. ViRb3 commented on Oct 30, 2026

    @ViRb3

    I think the real trigger is any active content-filter network extension (like Little Snitch 6.5 for me): #22082 (comment)

  14. ViRb3 commented on Oct 31, 2026

    @ViRb3
  15. nickoneill commented on Nov 3, 2026

    @nickoneill
    Contributor

    As mentioned above, this is likely a duplicate of #19504 and resolved in 1.104.5. Please retest there and comment on 19504 if your issue is not resolved.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macosbugconnectivity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions