Skip to content

stream: fix dropped first chunk in Utf8Stream buffer mode#63833

Open
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:buffer-fix
Open

stream: fix dropped first chunk in Utf8Stream buffer mode#63833
watilde wants to merge 1 commit into
nodejs:mainfrom
watilde:buffer-fix

Conversation

@watilde

@watilde watilde commented Jun 10, 2026

Copy link
Copy Markdown
Member

In buffer content mode, #writeBuffer pushed an empty array when starting a new batch (including the very first write), so the data buffer was never stored while its length was still recorded in lens. The first write then emitted zero bytes and the misaligned bufs/lens queues crashed in mergeBuf() with a TypeError. Push [data] instead, matching the upstream sonic-boom implementation.

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 10, 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

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 10, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 10, 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

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.

4 participants