FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Clarify when `readable._read(...)` is called. by sploders101 · Pull Request #38726 · nodejs/node · GitHub

/ node Public

Clarify when readable._read(...) is called. - #38726

Closed
sploders101 wants to merge 1 commit into
nodejs:masterfrom
sploders101:master
Closed

Clarify when readable._read(...) is called.#38726
sploders101 wants to merge 1 commit into
nodejs:masterfrom
sploders101:master

Conversation

Copy link
Copy Markdown
Contributor

Fixes: #38586

This PR clarifies some confusion with the readable._read(...) function dealing with when it is called. The current version of the documentation seems to suggest that _read() is responsible for looping itself to continually request data until this.push(...) returns false, but this is not the case. After implementing a readable stream this way, I quickly found memory leaks in my code, because Node.JS was calling my _read function after every this.push(...), but I was also looping inside _read, resulting in an exponentially increasing number of reads on the remote resource. Hopefully this will help to clarify this behavior.

This is my first PR against NodeJS, so please let me know if there's anything I could do better.

github-actions Bot added doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem. labels May 18, 2021
ronag requested a review from mcollina May 19, 2021 15:29

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

lgtm

Copy link
Copy Markdown
Collaborator

Comment thread doc/api/stream.md
Comment on lines +2517 to +2518
called again after it has stopped should it resume pushing additional data into
the queue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Was this change onto the queue → into the queue intentional? I noticed that into the read queue was used above, on line 2512, even before this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

It was not intentional, but I think accomplishes the same goal. I tried to reword the existing paragraph, but it always seemed confusing and contradictory, so I ended up just rewriting it. I think into makes more sense though. I'd only use onto if I were saying I'm pushing onto *the end of* the queue.

Ayase-252 added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jun 3, 2021
aduh95 pushed a commit that referenced this pull request Jun 3, 2021
Fixes: #38586

PR-URL: #38726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>

aduh95 commented Jun 3, 2021

Copy link
Copy Markdown
Contributor

Landed in 7f742ae

aduh95 closed this Jun 3, 2021
targos pushed a commit that referenced this pull request Jun 11, 2021
Fixes: #38586

PR-URL: #38726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
danielleadams mentioned this pull request Jun 14, 2021
richardlau pushed a commit that referenced this pull request Jul 16, 2021
Fixes: #38586

PR-URL: #38726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
richardlau pushed a commit that referenced this pull request Jul 19, 2021
Fixes: #38586

PR-URL: #38726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
richardlau pushed a commit that referenced this pull request Jul 20, 2021
Fixes: #38586

PR-URL: #38726
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
richardlau mentioned this pull request Jul 20, 2021
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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc: Unclear relationship between _read and stream.push return value

8 participants


Back | FazBrowse Home | New Git URL