Skip to content

atunnel: bound the tunnel open by a deadline - #2654

Merged
Lior Lieberman (LiorLieberman) merged 1 commit into
agent-substrate:mainfrom
ygao-g:atunnel-tunnel-open-deadline
Oct 14, 2026
Merged

Lior Lieberman (LiorLieberman) merged 1 commit into
agent-substrate:mainfrom
ygao-g:atunnel-tunnel-open-deadline

Conversation

@ygao-g

@ygao-g Yuan Gao (ygao-g) commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2619

atunnel waited for the gateway's CONNECT answer for as long as the actor stayed active. A gateway at its connection cap queues the CONNECT; the actor's client gives up in seconds, but the queued CONNECT kept its slot and later opened a tunnel nobody wanted.

The tunnel open now has a 10s deadline on the Egress side. Since the HTTP/2 multiplexing change, ending the dial context already resets the CONNECT stream, which withdraws it from the gateway's queue; this PR adds the test that pins that behavior and the deadline that triggers it for an actor that has gone away. A tunnel already returned is unaffected. The HTTP/1 fallback path is left as it was.

Tested with go test -race -count=20 ./internal/atunnel/... and the hack/verify scripts. New test: an Egress with a shortened timeout, dialing through the real client to a gateway that never answers, closes the actor's connection at the deadline while the gateway sees the stream reset.

Prepared with help from an AI coding agent; reviewed and verified by the author.

@ygao-g Yuan Gao (ygao-g) added area/network kind/bug Something isn't working / bugfixes labels Oct 14, 2026
@ygao-g
Yuan Gao (ygao-g) force-pushed the atunnel-tunnel-open-deadline branch from d45bbb7 to 3f783c6 Compare October 14, 2026 16:11
Bound the tunnel open by a 10s deadline, after timeout tunnel end the
dial context and withdraw HTTP/2 CONNECT from the gateway's queue.
Otherwise, even if the actor's client gives up within seconds, the
queued CONNECT on gateway still keep its slot and then opens a tunnel
nobody wants.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. fwiw if the actor bails early the queued CONNECT still sits there until the 10s mark (IIUC), maybe a follow-up to cancel on downstream close?

Merged via the queue into agent-substrate:main with commit afe2e3a Oct 14, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/network kind/bug Something isn't working / bugfixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

atunnel keeps a queued CONNECT alive after the actor gave up

3 participants