Conversation
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #66473 +/- ##
==========================================
+ Coverage 90.40% 90.42% +0.02%
==========================================
Files 791 791
Lines 276120 276315 +195
Branches 53022 53085 +63
==========================================
+ Hits 249618 249853 +235
+ Misses 16897 16871 -26
+ Partials 9605 9591 -14
🚀 New features to boost your workflow:
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
jasnell
force-pushed
the
jasnell/utf8stream-flush-fix
branch
from
October 4, 2026 11:13
8034879 to
d52d366
Compare
Member
Author
You're right. changing. Updated for both issues |
mcollina
added a commit
to pinojs/sonic-boom
that referenced
this pull request
Oct 4, 2026
- flush() with minLength 0 now waits for in-flight writes before calling the callback. - end() waits for pending flush callbacks before closing. - Concurrent flush() calls are tracked with counters. - flush() no longer fsyncs stdout/stderr and ignores EBADF. - Periodic flushes do not stack while a flush is pending. - end()/reopen()/destroy() while opening no longer double-close or throw; pending flushes fail with an error when the stream is destroyed. The flushSync() change from the upstream PR (throwing while a write is in progress) is intentionally left out as it is breaking.
mcollina
added a commit
to pinojs/sonic-boom
that referenced
this pull request
Oct 4, 2026
- flushSync() preserves ordering where it can: it cancels a pending EAGAIN/EBUSY retry and writes everything in order, writes the remainder of a partial write first when called from a 'write' listener, and writes to the previous file while reopening. With an async write in flight, only the queued data is written. - 'write' is emitted after the written bytes are released. - flushBufferSync() keeps _lens in sync when re-queuing _writingBuf. - flush() fsyncs stdout/stderr again (useful when redirected to a file) and ignores EBADF/EINVAL/ENOTSUP/EOPNOTSUPP/EROFS from fsync.
mcollina
added a commit
to pinojs/sonic-boom
that referenced
this pull request
Oct 5, 2026
Align with nodejs/node#66473: when destroy() is called while a write is in flight, a pending flush() now succeeds if all the data was written, and fails only if data is left. A pending EAGAIN/EBUSY retry is cancelled on destroy instead of writing to the closed fd.
Member
|
This needs a rebase now |
mcollina
added a commit
to pinojs/sonic-boom
that referenced
this pull request
Oct 5, 2026
* fix: flush handling (port of nodejs/node#66473) - flush() with minLength 0 now waits for in-flight writes before calling the callback. - end() waits for pending flush callbacks before closing. - Concurrent flush() calls are tracked with counters. - flush() no longer fsyncs stdout/stderr and ignores EBADF. - Periodic flushes do not stack while a flush is pending. - end()/reopen()/destroy() while opening no longer double-close or throw; pending flushes fail with an error when the stream is destroyed. The flushSync() change from the upstream PR (throwing while a write is in progress) is intentionally left out as it is breaking. * fix: port updated flushSync and fsync handling from nodejs/node#66473 - flushSync() preserves ordering where it can: it cancels a pending EAGAIN/EBUSY retry and writes everything in order, writes the remainder of a partial write first when called from a 'write' listener, and writes to the previous file while reopening. With an async write in flight, only the queued data is written. - 'write' is emitted after the written bytes are released. - flushBufferSync() keeps _lens in sync when re-queuing _writingBuf. - flush() fsyncs stdout/stderr again (useful when redirected to a file) and ignores EBADF/EINVAL/ENOTSUP/EOPNOTSUPP/EROFS from fsync. * fix: settle pending flushes after an in-flight write on destroy Align with nodejs/node#66473: when destroy() is called while a write is in flight, a pending flush() now succeeds if all the data was written, and fails only if data is left. A pending EAGAIN/EBUSY retry is cancelled on destroy instead of writing to the closed fd.
mcollina
added a commit
to pinojs/sonic-boom
that referenced
this pull request
Oct 5, 2026
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.
Fix several issues with `Utf8Stream` flushing: * `flush()` now writes buffered data regardless of `minLength` and invokes the callback only after pending writes complete, including when `minLength` is zero and a write is in flight. * Multiple concurrent `flush()` calls are tracked correctly and `end()` waits for pending flushes before closing. * `flushSync()` throws `ERR_INVALID_STATE` if called while an asynchronous write is in progress instead of corrupting output. * Periodic flushes no longer stack up while a flush is pending. * `fsync` is skipped for stdout/stderr file descriptors. * `reopen()`, `end()` and `destroy()` behave correctly when the stream is destroyed while still opening. Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
jasnell
force-pushed
the
jasnell/utf8stream-flush-fix
branch
from
October 5, 2026 21:59
d52d366 to
6a11fbc
Compare
Member
Author
|
@mcollina rebased... PTAL |
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.
Fix several issues with
Utf8Streamflushing:flush()now writes buffered data regardless ofminLengthand invokes the callback only after pending writes complete, including whenminLengthis zero and a write is in flight.flush()calls are tracked correctly andend()waits for pending flushes before closing.flushSync()throwsERR_INVALID_STATEif called while an asynchronous write is in progress instead of corrupting output.fsyncis skipped for stdout/stderr file descriptors.reopen(),end()anddestroy()behave correctly when the stream is destroyed while still opening.Separated out from #65840