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 — fix: mark the stream destroyed immediately when destroyed while opening by mcollina · Pull Request #260 · pinojs/sonic-boom

Conversation

@mcollina

@mcollina mcollina commented Oct 5, 2026

Copy link
Copy Markdown
Member

Follow-up to #259 (stacked on it; the diff below only contains this change). Aligns destroy() while the file is still opening with Utf8Stream in nodejs/node#66473.

cc @jasnell

Change

Before, destroy() during opening deferred everything until the file was open: destroyed stayed false, and write() kept accepting data that was then silently dropped.

Now, like Node.js:

  • destroyed is set immediately, so write() and end() throw and flush() calls back with SonicBoom destroyed, as on any destroyed stream. The fd is still closed once the file is open.
  • A flush() pending when the stream is destroyed while opening (or reopening) fails with an 'error' event (SonicBoom destroyed).
  • end() called before destroy() while opening no longer runs once the file is open, so 'finish' is not emitted; 'close' still is.

Compatibility

Code that calls write() or end() after destroy() during opening will now get an exception instead of having the data silently dropped. This matches the existing behaviour once the file is open, but may warrant a note in the release.

Tests

test/flush.test.js covers both cases; they fail on #259 and pass here. README destroy() docs updated.

Sorry, something went wrong.

Uh oh!

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

All reactions
@mcollina
mcollina changed the base branch from fix/flush-handling to master October 5, 2026 19:25
@mcollina
fix: mark the stream destroyed immediately when destroyed while opening
8695db5
Align with nodejs/node#66473: destroy() while the file is opening now
sets `destroyed` right away, so write()/end()/flush() behave as on any
destroyed stream instead of silently accepting data that is dropped.
A pending flush() is failed with an 'error' event.
@mcollina
mcollina force-pushed the fix/destroy-while-opening branch from 42bb792 to 8695db5 Compare October 5, 2026 19:26
@mcollina

mcollina commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

ping @jsumners

All reactions

Sorry, something went wrong.

Uh oh!

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

jasnell
jasnell approved these changes Oct 5, 2026
View reviewed changes
jsumners
jsumners approved these changes Oct 7, 2026
View reviewed changes
@mcollina
mcollina merged commit 53470d3 into master Oct 7, 2026
61 of 66 checks passed

Uh oh!

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

@mcollina
mcollina deleted the fix/destroy-while-opening branch October 7, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jsumners jsumners jsumners approved these changes
+1 more reviewer
@jasnell jasnell jasnell approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

3 participants

@mcollina @jsumners @jasnell
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 01402792 — 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.