• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive / 22970200192

11 Mar 2026 07:17PM UTC coverage: 64.084% (+0.01%) from 64.071%
22970200192

push

github

web-flow
Remove unused per-session channels from StreamableSession (#4076)

* Lazy-init StreamableSession channels to reduce memory under churn

StreamableSession eagerly allocated two buffered channels (100 slots
each, ~3 KB) per session, but neither the streamable HTTP proxy nor
the vMCP server ever use per-session channels — they route through
global proxy channels instead. Under high session churn (60k+
create/delete cycles), these unused allocations contributed to
monotonic memory growth leading to OOMKill.

Channels are now nil by default and lazily allocated via sync.Once on
first SendMessage/SendResponse call. Disconnect() guards against nil
channels. No behavioral change for callers that use the channels.

Relates to #4062

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Unit tests verify the lazy-init contract:
   - Channels are nil after construction
   - SendMessage/SendResponse allocate both channels on first call
   - Disconnect is safe with nil channels
   - Send after Disconnect returns error
   - GetData returns zeros when channels are nil

Signed-off-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com>

* Remove unused MessageCh, ResponseCh, SendMessage, SendResponse from StreamableSession

Neither the streamable HTTP proxy nor the vMCP server use per-session
channels — both route messages through global proxy-level channels.
Remove the dead fields and methods entirely rather than lazy-initializing
them, eliminating ~4 KB of wasted memory per session.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove trivial StreamableSession tests

The remaining tests only verified struct construction and a boolean
flag toggle — no meaningful behavior worth testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Signed-off-by: Chris Burns <29541485+ChrisJBurns@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Muhammad Amir Ejaz <amir@stacklok.com>

2 of 2 new or added lines in 1 file covered. (100.0%)

10 existing lines in 3 files now uncovered.

48030 of 74948 relevant lines covered (64.08%)

74.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.31
/pkg/transport/proxy/httpsse/http_proxy.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc