Skip to content

Clean up stale Tailnet WebSocket sessions - #8

Merged
lyc-aon merged 1 commit into
mainfrom
fix/gateway-stale-websocket-cleanup
Jul 13, 2026
Merged

Clean up stale Tailnet WebSocket sessions#8
lyc-aon merged 1 commit into
mainfrom
fix/gateway-stale-websocket-cleanup

Conversation

@lyc-aon

@lyc-aon lyc-aon commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What changed

  • add WebSocket ping/pong liveness checks to the loopback Tailnet gateway
  • terminate half-open browser tunnels that Tailscale Serve keeps established after the remote browser disappears
  • terminate tracked browser sockets during gateway shutdown so server.close() cannot wait on a stale proxy tunnel
  • cover both stale-client eviction and responsive-client survival

Why

The gateway previously removed sessions only after a WebSocket close or error. A closed Playwright/mobile browser could leave Tailscale Serve's 127.0.0.1 -> 4194 hop established indefinitely, so /healthz stayed at activeSessions: 1 and the OMP upstream bridge remained open.

Verification

  • pnpm check
  • pnpm test (780 tests)
  • pnpm test:tooling (23 tests, including both new heartbeat cases)
  • git diff --check

@lyc-aon
lyc-aon merged commit f108a5b into main Jul 13, 2026
1 check passed
@lyc-aon
lyc-aon deleted the fix/gateway-stale-websocket-cleanup branch July 13, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant