Skip to content

fix: pod logs streaming blocked by cleanResponseMiddleware buffering. Fixes #3470#3471

Draft
suryapratap-01 wants to merge 1 commit into
numaproj:mainfrom
suryapratap-01:fix/3470-pod-logs-streaming
Draft

fix: pod logs streaming blocked by cleanResponseMiddleware buffering. Fixes #3470#3471
suryapratap-01 wants to merge 1 commit into
numaproj:mainfrom
suryapratap-01:fix/3470-pod-logs-streaming

Conversation

@suryapratap-01

Copy link
Copy Markdown
Contributor

What this PR does / why we need it

In v1.8.0 the UI logs panel is stuck on "Loading logs..." and follow=true log requests return zero bytes. (#3098) buffers the entire response body and only flushes it after the handler returns — but PodLogs with follow=true streams forever and never returns, so no bytes ever reach the client.

Fix: skip the buffering for the /pods/:pod/logs route. It's the only streaming endpoint, returns plain text (no managedFields to strip), and auth middleware still runs.

Related issues

Fixes #3470

Testing

  • Added [TestCleanResponseMiddleware_SkipsPodLogsStreaming].
  • go test ./server/routes/ and make lint pass.
  • Verified on a live v1.8.0 cluster: follow=true curl → 200 with 0 bytes; with this fix
    a local build streams logs immediately and the UI panel works again.

Special notes for reviewers

Minimal route-scoped bypass, restores pre-1.8 behavior; no API changes.

Signed-off-by: Surya Singh <suryapratap.personal@gmail.com>
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.74%. Comparing base (eb80370) to head (62735d3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3471   +/-   ##
=======================================
  Coverage   82.74%   82.74%           
=======================================
  Files         308      308           
  Lines       78697    78700    +3     
=======================================
+ Hits        65115    65120    +5     
+ Misses      13015    13013    -2     
  Partials      567      567           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

return func(c *gin.Context) {
// Skip buffering for streaming endpoints (e.g. pod logs with follow=true),
// otherwise the response would never be written to the client.
if strings.HasSuffix(c.FullPath(), "/pods/:pod/logs") {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should implement a generic solution for future streaming endpoints eg:, new logs API

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

wilco

Comment thread server/routes/clean_response_middleware.go
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.

Pod logs panel stuck on "Loading logs..." — follow=true streaming broken by cleanResponseMiddleware

3 participants