Skip to content

stream: fix Utf8Stream stall after full write of multi-byte data#63964

Open
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:utf8-stream
Open

stream: fix Utf8Stream stall after full write of multi-byte data#63964
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:utf8-stream

Conversation

@watilde

@watilde watilde commented Jun 17, 2026

Copy link
Copy Markdown
Member

releaseWritingBuf() tracks the buffered length in characters but, on a full write, decremented it by the number of bytes reported by fs.write instead of the number of characters. For multi-byte UTF-8 data this drove the internal length to zero, so the stream emitted 'drain' and went idle while queued chunks were left unwritten. Convert the byte count to a character count in the full-write case as well.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels Jun 17, 2026
@trivikr trivikr added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Jun 18, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 18, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants