Skip to content

fix(shared/http): close idle connections to stop updater connection leak - #2648

Merged
yllada merged 1 commit into
release/v12.0.0from
backlog/v12-shared-http-close-idle-conns
Sep 19, 2026
Merged

yllada merged 1 commit into
release/v12.0.0from
backlog/v12-shared-http-close-idle-conns

Conversation

@yllada

@yllada yllada commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Same connection leak as the v11 backport: Download builds a fresh http.Transport per call and never reclaims its pooled keep-alive connection, so every download leaks an ESTABLISHED socket. The updater polls the dependencies endpoint every 5 minutes, accumulating one idle connection per poll until endpoints hit thousands.

Root Cause

net/http returns a fully-read response's connection to the transport's idle pool instead of closing the socket. The per-call transport is discarded on return, so nothing calls CloseIdleConnections() and the socket stays open until the server-side keep-alive timeout (or forever).

Each Download call built a fresh http.Transport whose pool was discarded
on return, so net/http returned the keep-alive connection to a pool that
nothing ever reclaimed. The updater polls the dependencies endpoint every
5 minutes, leaking one idle connection per poll until endpoints accumulated
thousands of ESTABLISHED sockets. DownloadAndVerify doubles the leak
(two downloads per call).

Close idle connections explicitly on return (DisableCompression already set
to match the per-call transport). Same fix as the v11 backport.
@github-actions

Copy link
Copy Markdown

🛑 AI review — High/critical findings

One or more high/critical issues were found. Please review and fix before merging if they're real.

🛑 architecture (gemini-3-flash-lite) — high/critical — please review

Summary: AI review could not parse model response — manual review recommended.

  • high (n/a):0 — ThreatWinds API returned HTTP 404 (fail-safe fallback — flagged for manual attention, does not block the merge).

🛑 bugs (gemini-3-flash-lite) — high/critical — please review

Summary: AI review could not parse model response — manual review recommended.

  • high (n/a):0 — ThreatWinds API returned HTTP 404 (fail-safe fallback — flagged for manual attention, does not block the merge).

🛑 security (gemini-3-flash-lite) — high/critical — please review

Summary: AI review could not parse model response — manual review recommended.

  • high (n/a):0 — ThreatWinds API returned HTTP 404 (fail-safe fallback — flagged for manual attention, does not block the merge).

🔴 go-deps — pending updates

🔍 Discovered 30 Go projects

📦 Dependencies with updates available:

  📁 ./plugins/soc-ai:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

  📁 ./plugins/shared:
     - github.com/nats-io/nats.go: v1.53.1 → v1.54.0

  📁 ./plugins/feeds:
     - github.com/threatwinds/go-sdk: v1.1.27-0.20260811073440-251cb9d842cd → v1.1.33

  📁 ./plugins/crowdstrike:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./plugins/sophos:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

  📁 ./plugins/bitdefender:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./plugins/soar:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

  📁 ./plugins/stats:
     - github.com/threatwinds/go-sdk: v1.1.27-0.20260811073440-251cb9d842cd → v1.1.33

  📁 ./plugins/azure:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./plugins/alerts:
     - github.com/threatwinds/go-sdk: v1.1.27-0.20260811073440-251cb9d842cd → v1.1.33

  📁 ./plugins/playground:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./plugins/events:
     - github.com/threatwinds/go-sdk: v1.1.27-0.20260819160318-c56c250bc585 → v1.1.33

  📁 ./plugins/geolocation:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

  📁 ./plugins/o365:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

  📁 ./plugins/aws:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./plugins/gcp:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

  📁 ./plugins/rule-flood-guard:
     - github.com/threatwinds/go-sdk: v1.1.27-0.20260811073440-251cb9d842cd → v1.1.33

  📁 ./tools/rulecheck:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./backend:
     - github.com/threatwinds/go-sdk: v1.1.27-0.20260819160318-c56c250bc585 → v1.1.33

  📁 ./collectors/as400:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./collectors/utmstack:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./collectors/forwarder:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./agent-manager:
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./log-input:
     - github.com/nats-io/nats.go: v1.53.1 → v1.54.0
     - github.com/threatwinds/go-sdk: v1.1.31 → v1.1.33

  📁 ./agent:
     - github.com/threatwinds/go-sdk: v1.1.28 → v1.1.33

❌ Please update dependencies before merging.

@yllada
yllada merged commit 10ea372 into release/v12.0.0 Sep 19, 2026
1 check passed
@yllada
yllada deleted the backlog/v12-shared-http-close-idle-conns branch September 19, 2026 15:36
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.

Updater service leaks one idle outbound connection per poll (shared/http/download.go)

1 participant