Skip to content

[BUG] Windows: WintunCreateAdapter fails with 0x38 "device not ready" after Modern Standby resume, requires reboot #124

Closed

Description

@Jensenwgd

Environment: Windows 11 build 10.0.26300 (S0 Modern Standby), WG Tunnel 2.4.1, Wintun DLL 0.14.1 / driver 0.14.0.0.

Symptom: After sleep/wake, CreateTUN fails within 1 second with problem code 0x38. All subsequent reconnect attempts fail. Restarting the service does not help; only a full machine reboot restores connectivity. S0 standby (without wake) also triggers failure.

Evidence: 14:42:06 adapter creation succeeded + keepalive; 14:52:23 failure; 16:13:52 failure during standby. Relevant snippets from service-wrapper.err.log can be provided.

Conflict mechanism: Wintun WintunCreateAdapter internally calls the undocumented DevCreateObjectQuery, waiting for a PnP device interface event with a fixed 15-second timeout. Within 1 second after Modern Standby wake, PnP/NDIS is not ready yet; the event has already fired but the notification was lost, so it times out and returns 0x38.

Conflict caused by AutoTunnel: AutoTunnel subscribes to network state changes (DesktopNativeNetworkMonitor), with only 300ms debounce and no power-state awareness (does not listen for WM_POWERBROADCAST / PBT_APMRESUMEAUTOMATIC, does not monitor S0 standby). At the wake instant (even during S0 standby), upon detecting network changes, it immediately executes stop() -> WintunCreateAdapter("wgtun2") to destroy and rebuild, landing exactly in the PnP-not-ready window, reliably triggering 0x38.

Root cause of persistent failure: AutoTunnel always uses the fixed adapter name wgtun2 + fixed GUID, with no open-first (does not first call WintunOpenAdapter to reuse an existing adapter), no stale devnode cleanup (does not remove non-present devnode after failure), no identity rotation (does not change name/GUID on retry). After one accidental failure, the leftover devnode stays stuck in Problem state; all subsequent rebuilds hit that bad identity, forming "failure until reboot."

Secondary impact: Blocking native adapter creation call; two consecutive 15-second blocks kill the Ktor WebSocket heartbeat (Ping timeout); after wake, HMAC timestamp mismatch (HmacShield ... HMAC Mismatch! Path: /backend/status), causing GUI to misjudge daemon as unreachable.

Expected fix: Delay 10–30 seconds after wake and wait for network ready before operating; open-first; clean up stale devnode or rotate identity (new adapter name/GUID) on failure; exponential backoff; suppress rebuild during S0 standby; expose the real problem code to the GUI instead of generic "daemon unreachable."

References: WireGuard/wintun#7, Firezone#4765, WhiteDNS#31, EasyTier#2770.

Activity

  1. added a commit that references this issue on Nov 21, 2026
    77e0acc
  2. added a commit that references this issue on Nov 25, 2026
    7ab3951
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions