Skip to content

fix(http): reap idle TCP tunnels to bound goroutine and fd growth - #405

Open
Okdusty wants to merge 1 commit into
xvzc:mainfrom
Okdusty:fix/tunnel-idle-timeout
Open

fix(http): reap idle TCP tunnels to bound goroutine and fd growth#405
Okdusty wants to merge 1 commit into
xvzc:mainfrom
Okdusty:fix/tunnel-idle-timeout

Conversation

@Okdusty

@Okdusty Okdusty commented Jul 11, 2026

Copy link
Copy Markdown

Established TCP tunnels blocked on reads with no deadline, so a peer that vanished without a FIN/RST left both copy goroutines and both fds alive forever. Under a busy client they accumulated over long uptime and drove CPU up (observed ~264% average after ~15h uptime; ~1% on a fresh process).

Wrap the tunnel conns in the existing IdleTimeoutConn, as the UDP path already does, so a fully-silent tunnel is reaped after DefaultTunnelIdleTimeout (300s). Activity in either direction resets the timer, so active transfers are unaffected, and the resulting timeout is already treated as a benign tunnel close.

Established TCP tunnels blocked on reads with no deadline, so a peer that
vanished without a FIN/RST left both copy goroutines and both fds alive
forever. Under a busy client they accumulated over long uptime and drove
CPU up (observed ~264% average after ~15h uptime; ~1% on a fresh process).

Wrap the tunnel conns in the existing IdleTimeoutConn, as the UDP path
already does, so a fully-silent tunnel is reaped after
DefaultTunnelIdleTimeout (300s). Activity in either direction resets the
timer, so active transfers are unaffected, and the resulting timeout is
already treated as a benign tunnel close.
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