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 — stream: fix regression on duplex end by mmomtchev · Pull Request #35941 · nodejs/node

Conversation

@mmomtchev

@mmomtchev mmomtchev commented Nov 3, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Fixes: #35926

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

Sorry, something went wrong.

Uh oh!

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

bricss and puzrin reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@nodejs-github-bot

nodejs-github-bot commented Nov 3, 2020

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams
All reactions

Sorry, something went wrong.

Uh oh!

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

@ronag

ronag commented Nov 3, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Missing test. Also I would like to understand how this can fix that issue. This seems wrong to me.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 3, 2020
mcollina
mcollina reviewed Nov 3, 2020
View reviewed changes
Comment thread test/parallel/test-stream-duplex-readable-end.js Outdated

@mcollina mcollina Nov 3, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

please remove the console.log and use a common.mustCall() with an assertion instead.

Sorry, something went wrong.

Uh oh!

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

All reactions

@mmomtchev mmomtchev Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I reshuffled it a little bit, 'data' doesn't get called on correct execution - but must be there in order to trigger the reading

Sorry, something went wrong.

Uh oh!

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

All reactions
mcollina
mcollina reviewed Nov 3, 2020
View reviewed changes
Comment thread test/parallel/test-stream-duplex-readable-end.js Outdated

@mcollina mcollina Nov 3, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I think this should be a mustCall(), not mustCallAtMost(). The algorithm is deterministic.

Sorry, something went wrong.

Uh oh!

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

All reactions
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 3, 2020
@nodejs-github-bot

nodejs-github-bot commented Nov 3, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/34034/

All reactions

Sorry, something went wrong.

Uh oh!

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

@mmomtchev

mmomtchev commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

Missing test. Also I would like to understand how this can fix that issue. This seems wrong to me.

Obtained by blindly comparing NODE_DEBUG outputs of node 12 vs node-master - they remain remarkably similar despite the fact that the code base has been throughly refactored

mcollina reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

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

@mmomtchev

mmomtchev commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

Missing test. Also I would like to understand how this can fix that issue. This seems wrong to me.

Obtained by blindly comparing NODE_DEBUG outputs of node 12 vs node-master - they remain remarkably similar despite the fact that the code base has been throughly refactored

Maybe it just reproduces the bug that made it working 😄

All reactions

Sorry, something went wrong.

Uh oh!

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

@ronag

ronag commented Nov 3, 2020

Copy link
Copy Markdown
Member

I feel there is a more fundamental issue here and suspect that this might just hide it.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mmomtchev

mmomtchev commented Nov 3, 2020

Copy link
Copy Markdown
Contributor Author

I feel there is a more fundamental issue here and suspect that this might just hide it.

I spent two hours yesterday evening and couldn't fully understand it. My theory is that returning false from _write pauses the stream and gives the 'end' chance to get delivered. Otherwise everything remains stuck in an endless loop with the 'end' waiting in a nextTick handler.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ronag

ronag commented Nov 3, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

I mean part of the problem here is that Readable.push(null) does not Writable.end() the writable side of the Transform.

We could fix that by:

if (this.readableEnded) {
  this.end()
}

inside the transform callback but that would cause a write after end error as I mentioned here.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ronag

ronag commented Nov 3, 2020 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Just to be clear that I don't mind landing this PR to fix behavior regression (it has some perf regression for sync case) but I don't think it actually solves the fundamental problem here.

mmomtchev and benjamingr reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

mcollina
mcollina approved these changes Nov 3, 2020
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm, I think this is fine.

Sorry, something went wrong.

Uh oh!

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

All reactions
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 3, 2020
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Nov 3, 2020
@nodejs-github-bot

nodejs-github-bot commented Nov 3, 2020

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/34035/

All reactions

Sorry, something went wrong.

Uh oh!

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

benjamingr
benjamingr approved these changes Nov 3, 2020
View reviewed changes

@benjamingr benjamingr left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Echoing Robert's "the fundamental issue needs addressing but this can land in the meantime" sentiment.

Sorry, something went wrong.

Uh oh!

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

All reactions
@puzrin

puzrin commented Nov 3, 2020

Copy link
Copy Markdown

Sorry if naive question. When this can be released?

All reactions

Sorry, something went wrong.

Uh oh!

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

@mcollina

mcollina commented Nov 3, 2020

Copy link
Copy Markdown
Member

This can land in another 40 hours. Then it'll ship in the next v15 in the next week or so. It needs to sit in a current release before being bumped to LTS for 2 weeks. My best guess is at least a month, if not a month and a half.

Given that it seems a pretty urgent regression, we might be ok in short-circuiting this. What do @nodejs/tsc @nodejs/releasers @nodejs/lts think?

All reactions

Sorry, something went wrong.

Uh oh!

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

@richardlau

richardlau commented Nov 3, 2020

Copy link
Copy Markdown
Member

@mcollina Do you know when the regression went out in the LTS releases? I'm open to short-circuiting the wait time if it's a recent regression and this PR has sign off from @nodejs/streams.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mcollina

mcollina commented Nov 3, 2020

Copy link
Copy Markdown
Member

@richardlau I think this has been there for most of v14 current cycle - not recent at all. It's not in v12.

richardlau reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@puzrin

puzrin commented Nov 3, 2020

Copy link
Copy Markdown

Just checked. This bug appeared in v14.1.0. Previous versions not affected.

richardlau and mcollina reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

@richardlau

richardlau commented Nov 3, 2020

Copy link
Copy Markdown
Member

@targos has been preparing a 15.x release for tomorrow, so if this should be urgently fixed perhaps fast tracking into tomorrow's release is an option? We pencilled in a 14.x release for this month but AFAIK haven't settled on an exact date but if this does go out in tomorrow's 15.x release it'll probably make it into the next 14.x release without needing to short circuit LTS wait times.

All reactions

Sorry, something went wrong.

Uh oh!

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

@mcollina

mcollina commented Nov 3, 2020

Copy link
Copy Markdown
Member

Then let's fast-track this

richardlau, benjamingr, and gengjiawen reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

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

@mcollina mcollina added the fast-track PRs proposed for a shorter-than-standard waiting period before landing. label Nov 3, 2020
@mcollina

mcollina commented Nov 3, 2020

Copy link
Copy Markdown
Member

cc @nodejs/tsc for awareness

MylesBorins reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@mcollina mcollina mentioned this pull request Nov 3, 2020
v15.1.0 release proposal #35948
Merged
@Trott

Trott commented Nov 20, 2020

Copy link
Copy Markdown
Member

@Trott , @lpinca was this supposed to be included? I am sorry if it was up to me to backport it? What is the usual process when a PR needs backporting?

I think releasers will cherry-pick and leave a note here if it doesn't land cleanly. @nodejs/releasers Should a backport to 14.x be opened at this time? Or hold off?

@mmomtchev If you're confident that this will not be able to be cherry-picked to the v14.x-staging branch and that it should be included, you can get open a backport release by following the instructions at https://github.com/nodejs/node/blob/master/doc/guides/backporting-to-release-lines.md.

All reactions

Sorry, something went wrong.

Uh oh!

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

@puzrin

puzrin commented Nov 20, 2020

Copy link
Copy Markdown

May be reopen #35926 until fix in v14 (LTS)? Bug is serious, IMO.

schmod reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@mmomtchev

mmomtchev commented Nov 20, 2020

Copy link
Copy Markdown
Contributor Author

I am confident, the file I modified does not exist on v14.x

All reactions

Sorry, something went wrong.

Uh oh!

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

mmomtchev added a commit to mmomtchev/node that referenced this pull request Nov 22, 2020
@mmomtchev
stream: fix regression on duplex end
c6fa9a6
Backport
Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Refs: nodejs#35941
Fixes: nodejs#35926
@mmomtchev mmomtchev mentioned this pull request Nov 22, 2020
[14.x] stream: fix regression on duplex end #36229
Closed
3 tasks done
@mmomtchev

mmomtchev commented Nov 22, 2020

Copy link
Copy Markdown
Contributor Author

@puzrin @Trott I submitted a PR to v14.x-staging with a backport of this change

puzrin reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

@wa-Nadoo wa-Nadoo mentioned this pull request Nov 22, 2020
stream: avoid drain for sync streams #32887
Closed
4 tasks done
codebytere pushed a commit that referenced this pull request Nov 22, 2020
@lpinca @codebytere
test: improve test-stream-duplex-readable-end
9405cdd
- Remove unneeded listener for the `'error'` event.
- Use `common.mustCall()`.
- Verify that the `src` stream gets paused.

PR-URL: #36056
Refs: #35941
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ricky Zhou <[email protected]>
enov pushed a commit to enov/node that referenced this pull request Dec 4, 2020
@mmomtchev @enov
stream: fix regression on duplex end
b0a1830
Backport
Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Refs: nodejs#35941
Fixes: nodejs#35926
@enov enov mentioned this pull request Dec 4, 2020
[14.x] stream: fix regression on duplex end #36375
Closed
3 tasks done
BethGriggs pushed a commit that referenced this pull request Dec 9, 2020
@mmomtchev @BethGriggs
stream: fix regression on duplex end
5904671
Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Add unit test for #35926

Refs: #35926

Backport-PR-URL: #36375
PR-URL: #35941
Fixes: #35926
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
BethGriggs pushed a commit that referenced this pull request Dec 9, 2020
@lpinca @BethGriggs
test: improve test-stream-duplex-readable-end
ac6b0c6
- Remove unneeded listener for the `'error'` event.
- Use `common.mustCall()`.
- Verify that the `src` stream gets paused.

PR-URL: #36056
Refs: #35941
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ricky Zhou <[email protected]>
BethGriggs pushed a commit that referenced this pull request Dec 10, 2020
@mmomtchev @BethGriggs
stream: fix regression on duplex end
631b021
Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Add unit test for #35926

Refs: #35926

Backport-PR-URL: #36375
PR-URL: #35941
Fixes: #35926
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
BethGriggs pushed a commit that referenced this pull request Dec 10, 2020
@lpinca @BethGriggs
test: improve test-stream-duplex-readable-end
a82b916
- Remove unneeded listener for the `'error'` event.
- Use `common.mustCall()`.
- Verify that the `src` stream gets paused.

PR-URL: #36056
Refs: #35941
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ricky Zhou <[email protected]>
@BethGriggs BethGriggs mentioned this pull request Dec 10, 2020
v14.15.2 proposal #36476
Merged
BethGriggs added a commit that referenced this pull request Dec 15, 2020
@BethGriggs
2020-12-15, Version 14.15.2 'Fermium' (LTS)
2b6dd9c
Notable Changes:

- **deps**:
  - upgrade npm to 6.14.9 (Myles Borins)
    #36450
  - update acorn to v8.0.4 (Michaël Zasso)
    #35791
- **doc**: add release key for Danielle Adams (Danielle Adams)
    #35545
- **http2**: check write not scheduled in scope destructor (David Halls)
    #36241
- **stream**: fix regression on duplex end (Momtchil Momtchev)
    #35941

PR-URL: #36476
BethGriggs pushed a commit that referenced this pull request Dec 15, 2020
@mmomtchev @BethGriggs
stream: fix regression on duplex end
1cefb7e
Decide the return status of writeOrBuffer before
calling stream.write which can reset state.length

Add unit test for #35926

Refs: #35926

Backport-PR-URL: #36375
PR-URL: #35941
Fixes: #35926
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
BethGriggs pushed a commit that referenced this pull request Dec 15, 2020
@lpinca @BethGriggs
test: improve test-stream-duplex-readable-end
8516c2e
- Remove unneeded listener for the `'error'` event.
- Use `common.mustCall()`.
- Verify that the `src` stream gets paused.

PR-URL: #36056
Refs: #35941
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Ricky Zhou <[email protected]>
BethGriggs added a commit that referenced this pull request Dec 15, 2020
@BethGriggs
2020-12-15, Version 14.15.2 'Fermium' (LTS)
a2f9a70
Notable Changes:

- **deps**:
  - upgrade npm to 6.14.9 (Myles Borins)
    #36450
  - update acorn to v8.0.4 (Michaël Zasso)
    #35791
- **doc**: add release key for Danielle Adams (Danielle Adams)
    #35545
- **http2**: check write not scheduled in scope destructor (David Halls)
    #36241
- **stream**: fix regression on duplex end (Momtchil Momtchev)
    #35941

PR-URL: #36476
BethGriggs added a commit that referenced this pull request Dec 15, 2020
@BethGriggs
2020-12-15, Version 14.15.2 'Fermium' (LTS)
a150926
Notable Changes:

- **deps**:
  - upgrade npm to 6.14.9 (Myles Borins)
    #36450
  - update acorn to v8.0.4 (Michaël Zasso)
    #35791
- **doc**: add release key for Danielle Adams (Danielle Adams)
    #35545
- **http2**: check write not scheduled in scope destructor (David Halls)
    #36241
- **stream**: fix regression on duplex end (Momtchil Momtchev)
    #35941

PR-URL: #36476
This was referenced Dec 18, 2020
[bug] POST -> Premature close stream fastify/fastify#2739
Closed
POST -> Premature close? sindresorhus/got#1556
Closed
@amotzte amotzte mentioned this pull request Jan 5, 2021
Can you upgrade chrome docker to latest LTS node.js? browserless/browserless#1200
Closed
@Heerschop Heerschop mentioned this pull request Jan 19, 2021
Script execution can freeze chanzo/script-launcher#128
Closed
@clshortfuse clshortfuse mentioned this pull request Feb 3, 2021
HTTP responses on Node v14.15.2+ hang #37210
Closed
@targos targos added backported-to-v14.x stream Issues and PRs related to Node.js streams. and removed fast-track PRs proposed for a shorter-than-standard waiting period before landing. labels Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@Trott Trott Trott approved these changes
@benjamingr benjamingr benjamingr approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

stream Issues and PRs related to Node.js streams.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

stream: regression in v14, this.push(null) in Transform doesn't emit end

Uh oh!

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

10 participants

@mmomtchev @nodejs-github-bot @ronag @puzrin @mcollina @richardlau @MylesBorins @Trott @benjamingr @targos
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 01402503 — 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.