GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — zlib: handle close before initialization by ADITHYAKUMARREDDY · Pull Request #67507 · nodejs/node

Conversation

@ADITHYAKUMARREDDY

@ADITHYAKUMARREDDY ADITHYAKUMARREDDY commented Nov 16, 2026

Copy link
Copy Markdown
Contributor
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

zlib, worker_threads

Description of change

When a worker thread is terminated via worker.terminate() during compression stream construction, execution halts after the native ZlibStream instance has been allocated (new binding.Zlib(mode)) but before handle.init(...) has been executed. As a result, the C++ object has init_done_ == false.

During isolate teardown (node::FreeEnvironment), the garbage collector / weak callback invokes the destructor ~CompressionStream(), which calls Close(). Previously, Close() asserted:

CHECK(init_done_ && "close before init");

Because CHECK() calls abort(), the entire Node.js runtime process crashed with an uncatchable native abort.

The underlying context classes (ZlibContext, BrotliContext, ZstdContext) already safely handle uninitialized destruction. This PR:

  1. Replaces the fatal assertion with a safe early return in CompressionStream::Close() when !init_done_, allowing uninitialized handles to close cleanly.
  2. Adds a regression test in test/parallel/test-zlib-worker-terminate-stream-construct.js asserting that the process does not abort.

Fixes: #67485

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ADITHYAKUMARREDDY
zlib: handle close before initialization
7dc6903
Fixes nodejs#67485

Signed-off-by: Adithya kumar Reddy Gopavaram <[email protected]>
@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 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

  • the guide for first-time contributors
  • the contribution and automation policies
  • the pull request guide
  • the AI use policy
  • the Code of Conduct

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ADITHYAKUMARREDDY
ADITHYAKUMARREDDY marked this pull request as ready for review November 16, 2026 03:57
ADITHYAKUMARREDDY
ADITHYAKUMARREDDY commented Nov 16, 2026
View reviewed changes

@ADITHYAKUMARREDDY ADITHYAKUMARREDDY left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@nicolasdma

nicolasdma commented Nov 16, 2026

Copy link
Copy Markdown

Thanks for picking this up! I tested it and this fixes the bug in the original repro

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Nov 18, 2026
View reviewed changes
@jasnell jasnell added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 18, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 18, 2026
@nodejs-github-bot

nodejs-github-bot commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79263/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Nov 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.68%. Comparing base (d105ef7) to head (7dc6903).
⚠️ Report is 280 commits behind head on main.

Files with missing lines Patch % Lines
src/node_zlib.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67507      +/-   ##
==========================================
+ Coverage   90.67%   90.68%   +0.01%     
==========================================
  Files         799      799              
  Lines      280245   280246       +1     
  Branches    54125    54115      -10     
==========================================
+ Hits       254100   254130      +30     
+ Misses      16280    16237      -43     
- Partials     9865     9879      +14     
Files with missing lines Coverage Δ
src/node_zlib.cc 80.42% <0.00%> (-0.31%) ⬇️

... 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Nov 24, 2026
View reviewed changes
@nodejs-github-bot

nodejs-github-bot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/79478/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@addaleax addaleax added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Nov 24, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 1106479 into nodejs:main Nov 25, 2026
102 of 104 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Landed in 1106479

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Nov 25, 2026
@aduh95 aduh95 mentioned this pull request Nov 25, 2026
2026-11-25, Version 27.0.0-alpha.0.2.0 (Alpha) #67757
Merged
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@ADITHYAKUMARREDDY @gabylb
zlib: handle close before initialization
6d77d81
Fixes nodejs#67485

Signed-off-by: Adithya kumar Reddy Gopavaram <[email protected]>
PR-URL: nodejs#67507
Fixes: nodejs#67485
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@addaleax addaleax addaleax approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. 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

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

worker.terminate() during zlib stream construction aborts the process: Assertion failed: init_done_ && "close before init"

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@ADITHYAKUMARREDDY @nicolasdma @nodejs-github-bot @jasnell @addaleax
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.