Skip to content

ensure end is called on inflaters and deflaters (1.4 branch)#1150

Merged
pjfanning merged 5 commits into
apache:1.4.xfrom
pjfanning:gzip-1.4
Jul 10, 2026
Merged

ensure end is called on inflaters and deflaters (1.4 branch)#1150
pjfanning merged 5 commits into
apache:1.4.xfrom
pjfanning:gzip-1.4

Conversation

@pjfanning

Copy link
Copy Markdown
Member

cherry picks
a06ad57 #1134
7591e2e #1142

pjfanning and others added 2 commits July 10, 2026 13:55
* Initial plan

* Apply remaining changes

* Update GzipSpec.scala

* Update GzipCompressor.scala

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
…pCompressor (apache#1142)

* Ensure deflater/inflater end() is called in DeflateCompressor and GzipCompressor

- DeflateCompressor: add deflaterEnded flag + idempotent endDeflater() method;
  call endDeflater() in finishWithBuffer() instead of deflater.end() directly
- GzipDecompressor: add postStop() calling inflater.end() + add createInflater()
  factory method for testability
- StreamUtils.byteStringTransformer: add optional cleanup callback, call it in
  postStop() when the stage is stopped before onUpstreamFinish()
- Encoder.singleUseEncoderFlow: pass cleanup callback that calls endDeflater()
  on DeflateCompressor instances to handle stream cancellation/failure
- DeflateSpec: add tests for deflater cleanup on normal finish and cancellation
- GzipSpec: add tests for inflater cleanup on normal finish and cancellation,
  and deflater cleanup on normal finish and cancellation

* compile issues

* Add explicit cleanup() to Compressor/DeflateCompressor; GzipCompressor inherits it

* revert GzipCompressor changes

* Update GzipSpec.scala

* Update GzipSpec.scala

* Update GzipSpec.scala

* review comments

* Refactor onUpstreamFinish method for clarity

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@pjfanning pjfanning marked this pull request as draft July 10, 2026 14:42
@pjfanning

Copy link
Copy Markdown
Member Author

There are broken tests in GzipSpec. I'll need to investigate them. It be an issue with the merge as these tests work ok in main branch. There is a possibility that they are flaky on main branch - I have seen some evidence of some flakiness but they are 3 tests that are reliably failing with this branch.

@pjfanning pjfanning marked this pull request as ready for review July 10, 2026 19:09
@pjfanning pjfanning merged commit 4c7c3c5 into apache:1.4.x Jul 10, 2026
10 checks passed
@pjfanning pjfanning deleted the gzip-1.4 branch July 10, 2026 19:09
@pjfanning pjfanning added this to the 1.4.0 milestone Jul 10, 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.

2 participants