Skip to content

fix(autonat): close dial-back connections to prevent memory leak#6528

Open
imabdulbasit wants to merge 1 commit into
libp2p:masterfrom
imabdulbasit:fix/autonat-close-probe-connection
Open

fix(autonat): close dial-back connections to prevent memory leak#6528
imabdulbasit wants to merge 1 commit into
libp2p:masterfrom
imabdulbasit:fix/autonat-close-probe-connection

Conversation

@imabdulbasit

@imabdulbasit imabdulbasit commented Jul 17, 2026

Copy link
Copy Markdown

Description

The AutoNAT server (v1 and v2) dials clients back on a newly allocated port to probe reachability but never closes the resulting connection: the result is delivered over the client's original connection, while other behaviours keep the dial-back connection alive indefinitely. On QUIC each such connection pins a dedicated quinn::Endpoint (its own UDP socket plus several MiB of buffers), so a probe-serving node leaks memory slowly but without bound. This PR closes the dial-back connection once the probe completes

AI Assistance Disclosure

Tools used (required — write none if no AI was used): Claude Code

Attestation (required):

  • I have read every line of this diff, understand what it does, and can explain it in review.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@imabdulbasit
imabdulbasit force-pushed the fix/autonat-close-probe-connection branch from 18e6d56 to 31bc937 Compare July 17, 2026 16:11
@imabdulbasit
imabdulbasit force-pushed the fix/autonat-close-probe-connection branch from 31bc937 to 500c5a4 Compare July 17, 2026 16:21
@imabdulbasit
imabdulbasit marked this pull request as ready for review July 17, 2026 16:26
@imabdulbasit imabdulbasit changed the title fix(autonat): close dial-back connections once probes complete fix(autonat): close dial-back connections to prevent memory leak Jul 17, 2026
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