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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants