-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: Unclear relationship between _read
and stream.push
return value
#38586
Comments
_read(size)
stream.push _read
and stream.push
return value
You should pay attention to Paying attention to the return value is most important if it's possible for |
That makes a little more sense. How would one utilize the return value of |
Without checking, I believe this is the case, yes. |
Ok, I think I know enough to start working on a pull request then, since someone will have to check it before it makes it into production, regardless. I've never updated node's documentation before though. Is it just the |
Yes that's correct. You can use |
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>
📗 API Reference Docs Problem
Location
Section of the site where the content exists
Affected URL(s):
Description
Concise explanation of the problem
The documentation for implementing a readable stream indicates that the
_read
function should continue reading from the resource untilstream.push
returns false. When I implemented my stream this way, I saw the opposite behavior.stream._read
was called every time it ranstream.push(...)
, resulting in hundreds of concurrent read operations.More Detail
I quickly noticed a memory leak in my application, because
readable._read
was getting called every time I ranreadable.push(...)
(when the buffer was belowhighWaterMark
), which meant there may be hundreds of concurrent read operations on the same resource. I would like to reword this section to eliminate this ambiguity and clarify that the_read
function may be called multiple times before reaching thehighWaterMark
.I would be interested in contributing to this, but I would want some clarification first. Why would we need to listen to the result of
stream.push(...)
if_read
doesn't get called when the buffer is full? For edge cases where data is pushed outside the_read
function,stream.push(...)
's return value is documented here, but it doesn't seem to have a use from within_read
.submit a pull request.
The text was updated successfully, but these errors were encountered: