Skip to content

Fix gzip double-close in EVM JSON-RPC responses#3176

Merged
masih merged 1 commit into
mainfrom
masih/gzip-fix
Apr 2, 2026
Merged

Fix gzip double-close in EVM JSON-RPC responses#3176
masih merged 1 commit into
mainfrom
masih/gzip-fix

Conversation

@masih

@masih masih commented Apr 2, 2026

Copy link
Copy Markdown
Collaborator

When an HTTP response has Content-Length set, gzipResponseWriter.Write() closes the gzip stream early to ensure the footer is flushed. However, the deferred close() then calls gz.Close() a second time, writing a duplicate gzip footer and producing a corrupted stream. Clients fail with Z_DATA_ERROR when decompressing.

Return the gzip writer to the pool and nil-out the reference in Write() so the deferred close() becomes a no-op.

When an HTTP response has Content-Length set, gzipResponseWriter.Write()
closes the gzip stream early to ensure the footer is flushed. However,
the deferred close() then calls gz.Close() a second time, writing a
duplicate gzip footer and producing a corrupted stream. Clients fail
with Z_DATA_ERROR when decompressing.

Return the gzip writer to the pool and nil-out the reference in Write()
so the deferred close() becomes a no-op.
@github-actions

github-actions Bot commented Apr 2, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedApr 2, 2026, 8:19 PM

@codecov

codecov Bot commented Apr 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.67%. Comparing base (a8b5cb7) to head (860a676).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3176   +/-   ##
=======================================
  Coverage   58.67%   58.67%           
=======================================
  Files        2055     2055           
  Lines      168425   168427    +2     
=======================================
+ Hits        98815    98817    +2     
  Misses      60796    60796           
  Partials     8814     8814           
Flag Coverage Δ
sei-chain-pr 66.71% <100.00%> (?)
sei-db 70.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
evmrpc/rpcstack.go 76.86% <100.00%> (+0.16%) ⬆️
🚀 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.

@masih masih added this pull request to the merge queue Apr 2, 2026
Merged via the queue into main with commit 2c00c3d Apr 2, 2026
43 of 44 checks passed
@masih masih deleted the masih/gzip-fix branch April 2, 2026 20:41
github-actions Bot pushed a commit that referenced this pull request Apr 2, 2026
When an HTTP response has Content-Length set, gzipResponseWriter.Write()
closes the gzip stream early to ensure the footer is flushed. However,
the deferred close() then calls gz.Close() a second time, writing a
duplicate gzip footer and producing a corrupted stream. Clients fail
with Z_DATA_ERROR when decompressing.

Return the gzip writer to the pool and nil-out the reference in Write()
so the deferred close() becomes a no-op.

(cherry picked from commit 2c00c3d)
@seidroid

seidroid Bot commented Apr 2, 2026

Copy link
Copy Markdown

Successfully created backport PR for release/v6.4:

masih added a commit that referenced this pull request Apr 2, 2026
…ses (#3177)

Backport of #3176 to `release/v6.4`.

Co-authored-by: Masih H. Derkani <m@derkani.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants