Skip to content

Fix destroy() usage in fd-slicer#170

Merged
thejoshwolfe merged 11 commits into
masterfrom
destroy-fd-slicer
May 21, 2026
Merged

Fix destroy() usage in fd-slicer#170
thejoshwolfe merged 11 commits into
masterfrom
destroy-fd-slicer

Conversation

@thejoshwolfe

@thejoshwolfe thejoshwolfe commented May 20, 2026

Copy link
Copy Markdown
Owner

(background) Node 8 added an actual readStream.destroy() which collided with yauzl+fd-slicer's custom implementation. Yauzl worked around this in #110 , but the problematic collision still existed in the vendored fd-slicer code.

This PR cleans up the destroy pattern in fd-slicer and adds several tests to make sure things are working better. It turns out there's always been a bug that no one reported with the combination of fromBuffer(), then openReadStream() on an uncompressed entry, then calling destroy() to interrupt processing partway through. There's a test for it now!

The motivating use case for writing this PR was async iteration being broken on read streams for uncompressed entries:

Closes #169

There's a test for that now too.

@thejoshwolfe thejoshwolfe marked this pull request as ready for review May 21, 2026 13:30
@thejoshwolfe thejoshwolfe merged commit cd9bd23 into master May 21, 2026
7 checks passed
@thejoshwolfe thejoshwolfe deleted the destroy-fd-slicer branch May 21, 2026 13:30
mrgoonie pushed a commit to mrgoonie/claudekit-cli that referenced this pull request May 26, 2026
Node >= 24.16.0 introduced a stream-lifecycle change that exposes a
long-standing bug in yauzl@2.10.0's vendored fd-slicer: its custom
`destroy()` collides with Node's native readable-stream destroy and
the deflate read stream stops emitting `data`/`end` partway through
a sufficiently-large entry. The outer Promise never settles, so
`ck new` hangs at "Extracting files... this may take a while" with
the spinner spinning indefinitely on Linux.

`extract-zip@2.0.1` is unmaintained (6 years stale) and still pins
`yauzl@^2.10.0`. The fix landed upstream in yauzl@3.3.1 but is not
reachable through extract-zip.

This mirrors the existing macOS handling: route Linux through the
system unzip binary first and only fall back to the JS path if the
binary is missing. On WSL2/Linux this replaces a >2-minute hang
with a ~300ms native extraction.

Refs:
- nodejs/node#63487  (Node 24.16.0 regression)
- thejoshwolfe/yauzl#169  (fd-slicer destroy collision)
- thejoshwolfe/yauzl#170  (fix shipped in yauzl@3.3.1)
- max-mapper/extract-zip#154  (unmaintained, no fix coming)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
decentraland-bot added a commit to decentraland/creator-hub that referenced this pull request May 31, 2026
Electron's postinstall silently fails on Node 24.16.0 due to a bug in
yauzl (used by extract-zip) that causes zip extraction to hang without
error. Override yauzl to ^3.3.1 which contains the upstream fix
(thejoshwolfe/yauzl#170). This resolves electron/electron#51619.

Also remove --silent from npm install commands in the Makefile so that
install errors are visible in CI output instead of being suppressed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
LautaroPetaccio pushed a commit to decentraland/creator-hub that referenced this pull request Jun 1, 2026
* chore: update Node.js to 24

Upgrade all CI workflow Node.js version references to Node 24 (LTS).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: resolve Electron install failure on Node 24

Electron's postinstall silently fails on Node 24.16.0 due to a bug in
yauzl (used by extract-zip) that causes zip extraction to hang without
error. Override yauzl to ^3.3.1 which contains the upstream fix
(thejoshwolfe/yauzl#170). This resolves electron/electron#51619.

Also remove --silent from npm install commands in the Makefile so that
install errors are visible in CI output instead of being suppressed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: update package-lock.json for yauzl override

Regenerate lockfile to resolve yauzl to v3.3.2 (via the override added
in the previous commit). This fixes the Electron binary extraction
failure on Node 24.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
pull Bot pushed a commit to steelburn/open-design that referenced this pull request Jun 4, 2026
…Node 24.16.0+ (nexu-io#3584)

fd-slicer's custom destroy() collides with Node 24.16.0's stream
lifecycle change, causing extract-zip to silently hang at 97% during
Electron binary extraction. yauzl 3.x drops fd-slicer entirely.
extract-zip is unmaintained and pins yauzl ^2.10.0, so the fix can
only flow through a pnpm override.

Refs: thejoshwolfe/yauzl#170, nodejs/node#63487

Co-authored-by: jeremeioss <jeremeibg@gmail.com>
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.

async iteration never starts for openReadStream on uncompressed entries

1 participant