Return on a stalled non-blocking gzprintf write - #1281
Open
carrerasdarren-cell wants to merge 1 commit into
Open
Return on a stalled non-blocking gzprintf write#1281carrerasdarren-cell wants to merge 1 commit into
carrerasdarren-cell wants to merge 1 commit into
Conversation
carrerasdarren-cell
marked this pull request as ready for review
July 15, 2026 20:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Z_BUF_ERRORimmediately when a formatted gzip write stalls on a non-blocking destinationgzvprintf()and the legacy C89gzprintf()implementationFixes #1256.
Root cause
When pending gzip output cannot be flushed, both formatted-write paths record
Z_BUF_ERRORbut continue processing the same input. The write cursor can remain at the end of the allocation, allowing the following copy to write beyond the heap buffer.Returning the recorded error at the stall point lets the caller wait for the descriptor to become writable and retry the same formatted write.
Validation
Z_BUF_ERROR, successfully retry the same write after draining the pipe, and close withZ_OKmake -j4 testmake -j4 testshared