-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify when readable._read(...)
is called.
#38726
Conversation
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
called again after it has stopped should it resume pushing additional data into | ||
the queue. |
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.
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.
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.
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
.
Landed in 7f742ae |
Fixes: nodejs#38586 PR-URL: nodejs#38726 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
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 untilthis.push(...)
returnsfalse
, 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 everythis.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.