Skip to content

sandbox-relay: server keepalive, so a P4 host whose network drops is detected before the router's 5 m timeout #439

Closed

Description

@pdettori

Follow-up from #437, P6 on Kubernetes slice 2 (#424). The final review found this. The gap predates slice 2, but slice 2 makes it matter: P4 hosts now attach over the WAN.

Where: packages/sandbox-relay/src/main.ts, newServer(). The gRPC server sets no keepalive options.

What happens:

  1. A P4 host's network drops without a TCP close. Examples: a NAT or EC2 security-group change, a host reboot, a cable pull.
  2. The relay keeps the old Attach stream until the OpenShift router's passthrough tunnel times out (haproxy.router.openshift.io/timeout: 5m on Route moca-relay). Until then:
    • the host's reconnect is refused as a duplicate sandboxId (relay.ts rejects a second live session for an ID);
    • turns leased to the stale sh:sandbox:records entry fail.

Fix:

  • Add server keepalive in newServer(): grpc.keepalive_time_ms and grpc.keepalive_timeout_ms (for example 30 s / 10 s), so a dead peer is detected in under a minute.
  • Check the server's ping policy against the worker's own 30 s client keepalive (remote-worker/internal/session/dial.go): grpc.http2.min_ping_interval_without_data_ms and grpc.keepalive_permit_without_calls. The relay must not answer the worker's pings with GOAWAY too_many_pings.
  • Test: a transport test in which a client stops reading or acking. The relay must tear the session down, and remove presence, within the keepalive bound.

The live run (#424 results) stayed attached for 24 minutes, 11 of them idle, with one attach. So the happy path is fine today; this is only about detecting a dead peer.

Activity

  1. added
    enhancement
    on Oct 5, 2026
  2. added this to the v0.11.0 milestone on Nov 17, 2026
  3. added a commit that references this issue on Nov 17, 2026
    e38bc9b
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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions