lib: fix blob.stream() causing hanging promises#48232
lib: fix blob.stream() causing hanging promises#48232nodejs-github-bot merged 3 commits intonodejs:mainfrom
Conversation
|
cc @nodejs/whatwg-stream |
mcollina
left a comment
There was a problem hiding this comment.
From my understanding of the code, this will read all the file without any backpressure kicking in. This is a recipe for memory leaks.
|
Ah good point, trying to add checks for the same |
This comment was marked as outdated.
This comment was marked as outdated.
|
Hey @mcollina in the latest commit I have added some manual backpressure checking and a test too, does this look ok? |
|
ping @mcollina |
mcollina
left a comment
There was a problem hiding this comment.
Can you please add a test where the flow control mechanism kicks in? I would expect to see c.desiredSize turn negative.
Co-authored-by: Matteo Collina <matteo.collina@gmail.com>
Sure adding tests for that |
- also work example code in nodejs#48232
…8916 Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: 8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: 8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: 8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: 8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: 8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: 8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: #48668 Fixes: #48916 Fixes: #48232 Refs: 8cc1438 PR-URL: #48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Refs: nodejs#47993 (comment) PR-URL: nodejs#48232 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438 PR-URL: nodejs#48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Refs: nodejs#47993 (comment) PR-URL: nodejs#48232 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438 PR-URL: nodejs#48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: #48668 Fixes: #48916 Fixes: #48232 Refs: 8cc1438 PR-URL: #48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438 PR-URL: nodejs#48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: nodejs#48668 Fixes: nodejs#48916 Fixes: nodejs#48232 Refs: nodejs@8cc1438 PR-URL: nodejs#48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: #48668 Fixes: #48916 Fixes: #48232 Refs: 8cc1438 PR-URL: #48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Add lacked calling resolve() for finish ReadableStream source.pull(). Fixes: #48668 Fixes: #48916 Fixes: #48232 Refs: 8cc1438 PR-URL: #48935 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
|
This does not land cleanly in |
|
Hey @ruyadorno will open a backport pr for this also note that this PR did introduce a bug 😅 which was fixed by #48935 should i include both the commits in the backport PR? |
Running the following script on node v20.2.0
would cause a promise hang and no output, In this PR have updated the pulling logic in
blob.stream()to keep pulling until we reach the end, similar to howblob.arrayBuffer()is implemented.Refs: #47993 (comment)