[Bug]: T3 Connect relearns the QUIC → HTTP/2 fallback on every connector start: handshake timeouts aren't counted, cloudflared's own fallback isn't persisted, and the watchdog restarts it mid-fallback #33928
Before submitting#
- I searched existing issues and did not find a duplicate. (#31468 mentions problem 1 below as a side note, but its fix, #29021, targets the VPN/MTU case and says
Fixes #31468. Merging it would close the issue with this part still open. #16344, #20382 and #26513 built the current fallback; this issue is about the gaps that remain.) - I included enough detail to reproduce or investigate the problem.
Area#
apps/server
Steps to reproduce#
- Run T3 Code with T3 Connect on a network that drops or degrades UDP 7844 but allows TCP 7844.
nc -z region1.v2.argotunnel.com 7844succeeds, and QUIC handshakes to the edge time out. Do not setTUNNEL_TRANSPORT_PROTOCOL. - Start or restart the desktop app.
- Watch Settings → Sharing and access,
relay-client.ndjson, and the connector's/ready.
Expected behavior#
- T3 notices that QUIC does not work here and starts cloudflared with
--protocol http2within about a minute. - After that, restarts (app restarts, watchdog restarts, and the route-change restarts from #29021) keep using HTTP/2 for the fallback TTL, instead of relearning it each time.
Actual behavior#
Every connector start costs about 3–6 minutes of cloudflared has not connected to Cloudflare yet (connector_not_ready). The tunnel only comes up when cloudflared falls back to http2 on its own. I see four separate problems (checked against main @ 20c3dd3, apps/server/src/cloud/ManagedEndpointRuntime.ts):
1. The QUIC stall counter ignores the main failure on these networks.
observeConnectorOutput calls noteQuicStall only for timeout: no recent network activity (~L658). Here, 17 of 18 QUIC dial failures were timeout: handshake did not complete in time. Even counting both messages, failures came about every 10–30 s, roughly 10–25 in a 5-minute window. That is below QUIC_STALLS_BEFORE_HTTP2 = 30. As a result, switchToHttp2 never runs for this failure.
2. A fallback that cloudflared does on its own is never recorded.
http2Ref and the persisted HTTP2_FALLBACK_STATE are set only in T3's own switchToHttp2 (L577). When cloudflared, started with L637) and does not persist it. Every later start begins with auto, falls back by itself and registers protocol=http2, T3 records that only in connector.protocol (auto again. My relay-client.ndjson from Nov 4 to Nov 10: all 8 starts logged protocol: "auto", and every connection registered since Nov 6 is protocol=http2. The fallback was relearned each time, for example 01:40:21 start (auto) → 01:43:17 Registered … protocol=http2.
3. The not-ready watchdog restarts cloudflared before its own fallback finishes.
cloudflared falls back only after rotating edge addresses with exponential backoff. On a fresh process here, that took about 2 min 40 s. The watchdog kills the connector after CONNECTOR_NOT_READY_CHECKS_BEFORE_RESTART = 6 × 30 s = 3 min, and the new process starts cloudflared's retry sequence from zero. In my run, the first process was killed at 3:00 and the second one only survived because the threshold doubles to 12 checks (6 min). On a slightly slower network the first restart happens every time. The restart also uses auto again, which ties back to problem 2.
4. The UI gives a generic message.
ConnectReachability already probes TCP 7844. When TCP 7844 works and the connector keeps logging QUIC dial failures, the UI still shows connector_not_ready: "Wait a minute. If it stays, check the network and the server log." A specific cause would point users to the right fix.
Interaction with #29021. That PR adds a restart whenever the host's route to the edge changes, for example a Wi-Fi switch or a VPN coming up. That restart is right for the MTU problem. On a QUIC-hostile network, though, each of those restarts costs another ~3 minutes until problems 1–2 are fixed.
Possible fixes (suggestions):
- Count
handshake did not complete in timeas a stall. Alternatively, trigger HTTP/2 when a connector started withautohas registered no QUIC connection within N minutes and has logged QUIC dial errors. - When a connector started with
autoregistersprotocol=http2, persistHTTP2_FALLBACK_STATEjust asswitchToHttp2does. - When the watchdog restarts a connector that never connected and that logged QUIC dial failures, restart it with
--protocol http2rather thanauto. - Add a reachability cause such as "QUIC (UDP 7844) is blocked on this network" that links to the
TUNNEL_TRANSPORT_PROTOCOL=http2workaround.
Impact#
Major degradation or frequent failure
Version or commit#
T3 Code (Beta) desktop with bundled server 0.1.8, managed cloudflared 2026.10.4. Relevant code unchanged on main @ 20c3dd3.
Environment#
macOS 27.2 (Apple silicon), desktop app with the bundled server, T3 Connect managed tunnel. Home or travel router; Tailscale running without an exit node, so the default route does not go through Tailscale.
Logs or stack traces#
relay-client.ndjson, 2026-11-10 (UTC; tunnel IDs, names and pids removed):
11:44:08 Relay client process started; waiting for tunnel connection { version: "2026.10.4", protocol: "auto" } # process A
11:44:18 … 11:47:03 9× ERR Failed to dial a quic connection error="failed to dial to edge with quic: timeout: handshake did not complete in time"
11:47:08 Relay client has no tunnel connection; restarting it { notReadyChecks: 6 }
11:47:08 Relay client process started; waiting for tunnel connection { protocol: "auto" } # process B
11:47:18 … 11:49:07 8× … timeout: handshake did not complete in time
11:49:23 1× … timeout: no recent network activity
11:49:45 WRN If this log occurs persistently, and cloudflared is unable to connect to Cloudflare Network with `quic` protocol, then most likely your machine/network is getting its egress UDP to port 7844 (or others) blocked or dropped. …
11:49:47 INF Registered tunnel connection connIndex=0 … protocol=http2 (then connIndex 1–3, all http2)
"Relay client keeps losing QUIC connections; switching to HTTP/2" does not appear anywhere in the logs.
cloudflared metrics on the stuck process B before the fallback:
/ready → {"status":503,"readyConnections":0}
quic_client_total_connections 9
quic_client_closed_connections 8
quic_client_sent_bytes{conn_index="0"} 89936
quic_client_receive_bytes{conn_index="0"} 3180
quic_client_buffered_packets{conn_index="0",packet_type="handshake"} 57
TCP 7844 to the edge: nc -z 198.41.192.27 7844 succeeds.
Protocol history in relay-client.ndjson from Nov 4 to Nov 10: 8 of 8 Relay client process started entries have protocol: "auto". All 8 Registered tunnel connection connIndex=0 lines since Nov 6 have protocol=http2. For example, 2026-11-10T01:40:21Z start (auto) → 01:43:17Z registered protocol=http2, so about 3 minutes down after that start alone.
Workaround#
Set TUNNEL_TRANSPORT_PROTOCOL=http2 in the server's environment. On macOS, run launchctl setenv TUNNEL_TRANSPORT_PROTOCOL http2 and then restart T3 Code. T3 then treats HTTP/2 as the user's choice. Alternatively, allow outbound UDP 7844 on the network.
tanstack-source added labelsbug
maria-rcks closed this
Umais-Adeed(GitHub profile, opens in a new tab) linked this to #34167
Sign in to join this conversation.
Thanks for #34167 and for verifying it on a real QUIC-blocked setup. That fixes problem 2: T3 now remembers a fallback that cloudflared made on its own.
The PR's
Fixes #33928closed the whole issue automatically, but the PR description says the other three problems were "left for separate changes". Onmain@ 9771c5f they still apply. Could a maintainer reopen this issue so they stay tracked? GitHub won't let me reopen it because a maintainer closed it:observeConnectorOutputstill callsnoteQuicStallonly fortimeout: no recent network activity(ManagedEndpointRuntime.ts~L670), andQUIC_STALLS_BEFORE_HTTP2is still 30. On networks where QUIC fails withhandshake did not complete in time, T3's ownswitchToHttp2never fires.CONNECTOR_NOT_READY_CHECKS_BEFORE_RESTART = 6× 30 s = 3 min, and the cloudflared fallback took about 1.5–2.7 min in both my logs and the verification on #34167. A connector that never connected and has logged QUIC dial errors could be restarted with--protocol http2instead ofauto.ConnectReachabilitystill reportsconnector_not_ready("Wait a minute…") when TCP 7844 works and QUIC keeps failing.With #34167 these cost one slow start every 24 hours instead of one on every start, so they matter less now. They still affect the first start on a new network, and every start after the 24-hour window ends. If you'd rather track them as separate issues, I'm happy to split them out and close this one.