Repository navigation
zlib: prevent concurrent parameter changes - #67609
Open
ShogunPanda wants to merge 1 commit into
Open
ShogunPanda wants to merge 1 commit into
ShogunPanda wants to merge 1 commit into
Conversation
Apply `params()` changes as an ordered operation before the next queued write starts, so `deflateParams()` can no longer run on the threadpool concurrently with `deflate()` on the same stream, and make the native `params()` binding throw while a write is in progress. Skip the change if the stream was destroyed or errored in the meantime. Add regression tests. Assisted-By: OpenAI GPT-5.6 Sol <openai/gpt-5.6-sol> Signed-off-by: Paolo Insogna <paolo@cowtech.it>
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.
zlib.params()only deferred the parameter change behind a flush. When writes were queued behind that flush, the next write could be dispatched to the threadpool before the parameters were applied on the main thread, sodeflateParams()anddeflate()could run concurrently on the samez_stream.Parameter changes are now applied as an ordered operation before the next queued write starts, and the native
params()binding throws if a write is in progress, likereset()already does. A change that is still pending when the stream is destroyed or errors is not applied. Consecutiveparams()calls are compared against the last requested values, so a change back to the original values is no longer skipped.Adds regression tests for the public API race, the native guard, a parameter change with no following write, flush/params/write ordering and destroying a stream with a pending change.
This touches
lib/zlib.jsandsrc/node_zlib.cclike #67603; I'm happy to rebase on top of it or the other way around, whichever lands first.AI-assisted work. All changes reviewed by a human.