Skip to content

Service mode: privateNetworkOnly gate silently resets every connection, including loopback, for hours #31636

Closed

Description

@spiky02plateau

What happens

A headless T3 Code service (t3 __service-launcher, server 0.1.5-nightly.20261029.3877, Node 26.12.1 SEA, macOS 27) became unreachable three times in two days while the process kept running and the T3 Connect tunnel stayed up:

Unreachable from Recovered
2026-10-31 12:18 15:13, on its own
2026-10-31 16:18 19:38, on its own
2026-11-01 12:09 2026-11-02 14:05, only after a service restart

During each window every TCP connection to port 3773 was accepted and then reset, including a plain curl http://127.0.0.1:3773/ on the host itself.
cloudflared logged read: connection reset by peer against 127.0.0.1:3773, and the reachability check reported cause: origin_unreachable.
Background workers kept running with millisecond spans the whole time, the process held 47 file descriptors, and the event loop showed no stalls.

Where the reset comes from

With no explicit host, service mode listens on 0.0.0.0 with privateNetworkOnly, and apps/server/src/server.ts installs:

server.on("connection", (socket) => {
  if (!acceptsPrivateNetworkConnection(socket)) socket.destroy();
});

acceptsPrivateNetworkConnection (apps/server/src/startupAccess.ts) rejects a socket when either localAddress or remoteAddress is undefined or not a private IPv4 address.
This is the only connection-level destroy() in the server bundle; rejectRequestsUntilServing answers 503 and the preemptive shutdown grace is 0.
Loopback passes the address test, so the likely trigger is the socket reporting an undefined address, but the gate leaves no trace, so I could not confirm it.

Requests

  1. Log each rejected connection with its local and remote address, so the trigger can be found.
  2. Decide whether an undefined address should be retried or treated differently from a public one; today it fails closed with no signal.

Workaround

Binding the service to loopback skips the gate: T3CODE_HOST=127.0.0.1 in service.env, or in the plist's EnvironmentVariables for a service whose launcher predates service.env.
T3 Connect and tailscale serve both proxy to loopback and keep working; only direct LAN access is lost.
New services already default to loopback (T3CODE_LAN=false, related to #26012), so this mostly bites services installed before that default and anyone who opts into LAN access.

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