Skip to content

zlib: throw on init() while a write is in progress - #67616

Open
ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:zlib-init-guard
Open

ShogunPanda wants to merge 1 commit into
nodejs:mainfrom
ShogunPanda:zlib-init-guard

Conversation

@ShogunPanda

Copy link
Copy Markdown
Contributor

reset() and close() already guard against a write in progress, but the init() binding for the zlib, Brotli and Zstd streams did not. Calling it while a write was running on the thread pool reinitialized the context under it.

This makes init() throw in that case, matching reset(), and adds a test.

AI-assisted work. All changes reviewed by a human.

init() on a compression stream handle could reinitialize the context
while a write was still running on the thread pool. Throw instead, like
reset() already does.

Assisted-By: OpenAI GPT-5.6 Sol <openai/gpt-5.6-sol>
Signed-off-by: Paolo Insogna <paolo@cowtech.it>
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib module and its compression dependencies. labels Nov 19, 2026
@codecov

codecov Bot commented Nov 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.72%. Comparing base (d9e18d5) to head (e9280cc).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/node_zlib.cc 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67616      +/-   ##
==========================================
- Coverage   90.72%   90.72%   -0.01%     
==========================================
  Files         801      801              
  Lines      280809   280817       +8     
  Branches    54212    54215       +3     
==========================================
  Hits       254776   254776              
- Misses      16209    16247      +38     
+ Partials     9824     9794      -30     
Files with missing lines Coverage Δ
src/node_zlib.cc 80.53% <80.00%> (+0.11%) ⬆️

... and 38 files with indirect coverage changes

🚀 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib module and its compression dependencies.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants