Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Summary
On networks that drop QUIC (UDP 7844) but allow TCP 7844, T3 Connect goes down for long periods. The managed cloudflared keeps dialing QUIC instead of using HTTP/2, which works on the same networks. This is common on corporate networks: full-tunnel VPNs that fall back from IPsec to an SSL/TLS (TCP 443) tunnel often stop passing QUIC, and some office and tethered networks behave the same way.
T3 always spawns cloudflared tunnel --no-autoupdate --loglevel info --output default run with the default --protocol auto, and it offers no way to choose the transport. A user who knows the network blocks QUIC can't do anything about it. A watchdog that restarts cloudflared (as proposed in #16258) helps less than you'd expect here, for the reasons below.
Why cloudflared doesn't recover on its own (cloudflared 2026.5.2)
- Fallback is permanently suppressed once QUIC has ever connected. In
supervisor/tunnel.go,Serve()returns before choosing a fallback whene.tracker.HasConnectedWith(e.config.ProtocolSelector.Current())is true. Intunnelstate/conntracker.go,HasConnectedWithonly checksci.Protocol == protocoland ignoresIsConnected. Disconnect events only setIsConnected = false, so the protocol record stays. A connector that used QUIC once, for example at home, never falls back to HTTP/2 after the laptop moves to a QUIC-blocking network. It sits atreadyConnections: 0until it is restarted. - Even a fresh process falls back slowly. For
EdgeQuicDialError,IpAddrFallback.ShouldGetNewAddressonly reports a fallback-worthy connectivity error aftermaxRetriesedge-address rotations per connection, and the backoff between attempts grows exponentially. In our logs the retry gaps grew from about 20 s to 2 min to 4.5 min. A fresh connector that had never connected over QUIC took about 18 minutes to fall back. - The fallback doesn't stick. One long-lived connector registered over
http2at startup, then registered overquicagain on a later reconnect within the same process. It then hit (1) on the next QUIC-blocking network.
So restarting cloudflared resets (1), but on a QUIC-blocking network the new process still starts with QUIC and needs many minutes to fall back.
Steps to reproduce
- On a network where QUIC works, start the desktop app with T3 Connect on. Confirm a phone can connect.
cloudflaredregisters 4 connections withprotocol=quic. - Move the host to a network that drops UDP 7844 but allows TCP 7844. In our case this was a corporate full-tunnel VPN running in SSL/TLS fallback mode, on both office Wi-Fi and a phone hotspot.
- Observe
curl -s http://127.0.0.1:<metrics-port>/ready. It returns{"status":503,"readyConnections":0,...}and stays there. The log shows repeatedfailed to dial to edge with quic: timeout: no recent network activityorhandshake did not complete in time. - Try to connect from the phone. It shows
Remote environment endpoint https://<relay-host>/oauth/token timed out after 10000msor a similar error.
Expected behavior
- A setting to choose the managed connector's transport:
auto(default),http2, orquic, passed tocloudflaredas--protocol. An equivalent flag or env var fort3 servewould also help headless hosts. - Optionally, if the connector can't register over QUIC for a while, T3 could respawn it with
--protocol http2. This would fit the watchdog proposed in [Bug]: T3 Connect stays down after a network change: cloudflared keeps running with zero connections and is never restarted #16258. A restart that keepsautomay not help on these networks.
Actual behavior
What we measured on the same host (macOS, Apple silicon):
| Host network | VPN transport | QUIC to tunnel edge (UDP 7844) | TCP 7844 | T3 Connect |
|---|---|---|---|---|
| Home broadband | IPsec | works | works | fine |
| Phone hotspot | IPsec failed → SSL/TLS | dropped or degraded | works | flaky: 22 of 29 relay-minted pairing credentials were never exchanged, and the phone timed out on /oauth/token |
| Office Wi-Fi | IPsec failed → SSL/TLS | no reply | works | down: 0 ready connections for ~45 min, until the app was restarted with HTTP/2 forced |
| Office Wi-Fi, socket bound to the Wi-Fi interface (bypassing the VPN) | – | version-negotiation reply in 6–7 ms | works | – |
- QUIC was checked with a raw QUIC version-negotiation probe (reserved version
0x0a0a0a0a). TCP 7844 was checked withnc -z. - On the blocked path, the connector's metrics showed
quic_client_total_connectionsclimbing (45 → 115) withquic_client_latest_rtt 0and no received bytes. - After forcing HTTP/2 (see Workaround), the connector registered 4 connections with
protocol=http2within a minute on the same office network./.well-known/t3/environmentthrough the relay hostname answered200in about 0.1 s.
Impact
Major degradation or frequent failure
Version or commit
Desktop 0.0.46-nightly.20261005.2702 (macOS "T3 Code (Nightly)")
Environment
macOS 26.6.2 (Apple silicon), managed cloudflared 2026.5.2, iOS app (build 105), corporate full-tunnel VPN with IPsec → SSL/TLS fallback
Logs or stack traces
ERR Failed to dial a quic connection error="failed to dial to edge with quic: timeout: no recent network activity" connIndex=0 event=0 ip=198.41.200.113
WRN Failed to dial a quic connection error="failed to dial to edge with quic: timeout: handshake did not complete in time" connIndex=0 event=0 ip=198.41.200.113
# /ready on the stuck connector:
{"status":503,"readyConnections":0,"connectorId":"<redacted>"}
# after forcing http2, same network:
INF Registered tunnel connection connIndex=0 ... location=<redacted> protocol=http2
Workaround
T3 spawns cloudflared with env: { ...process.env, TUNNEL_TOKEN }, so cloudflared's own env var for --protocol is inherited:
launchctl setenv TUNNEL_TRANSPORT_PROTOCOL http2
# then quit T3 Code and relaunch it from the Dock or FinderThis is undocumented, applies to every app launched afterwards, and is lost on reboot or logout. Turning the VPN off also works, but that's often not an option on a work machine.
Related
- [Bug]: T3 Connect stays down after a network change: cloudflared keeps running with zero connections and is never restarted #16258: a connector stuck at zero connections is never restarted. The proposed watchdog would help with (1) above, but not with (2) or (3) unless it can switch to HTTP/2.
- T3 Connect: new connections fail after the host joins a VPN because the managed cloudflared keeps a stale QUIC MTU #15897: stale QUIC MTU after joining a VPN. It lists "let users force
--protocol http2" as one possible direction. - [Bug]: T3 Connect treats a spawned but unreachable tunnel as 'running' #7447: a connector is reported as
runningbefore it registers.
Activity
juliusmarminge commentedon Oct 6, 2026
Note
Grok responding on behalf of Julius.
Triage
Thanks for the measurements and the detailed cloudflared walkthrough, @mats16! This lines up with what we see in the code, and it's separate from the nearby tunnel issues.
What I found
CloudManagedEndpointRuntimeinapps/server/src/cloud/ManagedEndpointRuntime.tsspawnscloudflared tunnel --no-autoupdate --loglevel info --output default runand adds onlyTUNNEL_TOKENon top ofprocess.env. There's no--protocol, server flag, or setting. The pinned binary is cloudflared2026.5.2(CLOUDFLARED_VERSIONinpackages/shared/src/relayClient.ts), andrunningmeans the child is alive, not that a tunnel connection registered.TUNNEL_TRANSPORT_PROTOCOLis cloudflared's own env var for its hidden--protocolflag. Because the spawn spreadsprocess.env, yourlaunchctl setenvworkaround reaches the child after a relaunch. That works through inheritance rather than a supported setting.autowith a tunnel token, cloudflared2026.5.2starts on QUIC and treats HTTP/2 as a fallback. The three behaviors you described are all in that tag:tunnelstate.ConnTracker.HasConnectedWithmatches on protocol only, and a disconnect leaves the protocol record in place, so one QUIC registration suppresses HTTP/2 fallback for the rest of the process.IpAddrFallbackhas rotated edge addressesMaxEdgeAddrRetriestimes (default 8). With a 5s QUIC handshake idle timeout and backoff capped around 30s, that's a multi-minute stall. Startup connectivity pre-checks are diagnostic only.protocolFallback.reset(), which clearsinFallbackbut leaves the selector on QUIC, so the next retry goes back to QUIC ("registered http2, then quic again").superviseConnectoronly restarts the child after it exits. A zero-connection watchdog that respawns with the sameautoargs (like the one proposed on [Bug]: T3 Connect stays down after a network change: cloudflared keeps running with zero connections and is never restarted #16258) would reset the QUIC memory and start on QUIC again, and could restart before the edge-address rotations finish./readystays 200), [Bug]: T3 Connect treats a spawned but unreachable tunnel as 'running' #7447 (status saysrunningbefore the first registration).Likely fix area
Some options:
autodefault,http2,quic) through to the spawn as--protocol, reachable from botht3 serveand the desktop app. Since the Connect origin is loopback HTTP rather than Cloudflare private routing, the ICMP/UDP limitation cloudflared prints for HTTP/2 shouldn't matter here.--protocol http2after QUIC fails to register, since a plainautorestart won't stick on these networks.A maintainer will decide on the fix direction.
AlfaBlok commentedon Oct 13, 2026
Data point for headless hosts: the env-inheritance workaround works with
t3 serverun as a systemd user service on Linux (0.0.46-nightly.20261013.3066, pinned cloudflared 2026.10.0). This drop-in at~/.config/systemd/user/t3code.service.d/relay-protocol.conf:After
systemctl --user daemon-reload && systemctl --user restart t3code, all 4 connections registered withprotocol=http2and the relay probe answered 200.We switched for a different reason than blocked QUIC: on a datacenter VPS the QUIC sessions got closed by the edge (
Application error 0x0 (remote)) and the connector then went quiet for 98 minutes (details in #16258). A first-class setting ort3 serveflag would beat relying on env inheritance.knocking4thcylinder commentedon Oct 16, 2026
Note
Posted by Claude Code on behalf of @knocking4thcylinder.
Another data point, with a failure mode that may help with the fix direction: QUIC registers, then stalls seconds later. Every retry registers again, so cloudflared's own HTTP/2 fallback never triggers.
Environment: Linux (SteamOS),
t3 serveas a systemd user service, 0.1.1-nightly.20261016, pinned cloudflared 2026.10.0. The host is in Russia behind an Xray-based TUN proxy. I tried cloudflared both through the proxy and routed direct.What the connector does, from
boot-service.log:INF Registered tunnel connection ... location=dme06 protocol=quic.failed to dial to edge with quic: timeout: no recent network activitydatagram manager error: timeout: no recent network activityfailed to accept QUIC stream: timeout: no recent network activityprotocol=http2never appeared.autonever reaches it, because each new registration clears the fallback state as described in the triage above.TUNNEL_TRANSPORT_PROTOCOL=http2through a systemd drop-in is the same workaround @AlfaBlok used.Two smaller things showed up while digging. Neither is required for the fix here.
RELAY_RESTART_STABLE_UPTIME_MS(30s). The crash-loop backoff therefore reset on every exit, and the connector restarted every 30s all day.I opened a PR that implements the second option from the triage: switch to
--protocol http2automatically when QUIC keeps stalling, and leave an explicitTUNNEL_TRANSPORT_PROTOCOLalone. I'll link it here.knocking4thcylinder commentedon Oct 16, 2026
PR: #20382 switches the managed connector to
--protocol http2after 30 QUIC idle timeouts in 5 minutes. (Posted by Claude Code on behalf of @knocking4thcylinder.)knocking4thcylinder commentedon Oct 16, 2026
Note
Posted by Claude Code on behalf of @knocking4thcylinder.
A follow-up on the cause of the stalls in my earlier comment: the most likely explanation is Russian ISP filtering of QUIC/UDP, not something specific to my setup. With cloudflared routed direct (no proxy), it connects to Russian edge locations (
dme,led). QUIC registers there and then dies within seconds, while TCP to the same edge on port 7844 and ordinary HTTPS to Cloudflare both work normally.So this probably affects T3 Connect for many users in Russia, not only those behind unusual proxies. They'll see the tunnel flap and never become reliably reachable unless the connector uses HTTP/2. A blocked UDP path that lets QUIC handshakes through and then cuts them is exactly the case cloudflared's
autofallback misses, which is what #20382 addresses.juliusmarminge commentedon Oct 20, 2026
Note
Grok responding on behalf of Julius.
Closing this since #20382 just landed on main. The managed connector now counts QUIC idle timeouts (
timeout: no recent network activityon dial, datagram, or stream) and, after 30 of them in a five-minute window, restartscloudflaredwith--protocol http2for the rest of the server runtime. Restarting the server tries automatic transport again. If you want to force a transport up front, an explicitTUNNEL_TRANSPORT_PROTOCOLin the server's environment still takes precedence.If the tunnel still stays down on a QUIC-blocking network after this ships in a nightly, please reopen with the
cloudflaredlog lines and we'll take another look.