-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Node 16.14.2 highWaterMark:0 doesn't handle backpressure #42457
Comments
@nodejs/streams |
It seems #40947 should not have been backported at least. @kanongil @paulrutter what behavior were you expecting for |
My thought with using highwatermark 0 was to not buffer any chunks, instead just wait until the current chunk is done and then proceed to the next chunk. |
Essentially you assumed that it would be the same behavior of In my mind a value of 0 would be "false", so no buffering at all. The current behavior matches that description. |
Yes, true. In hindsight, using 1 would have made more sense. Still i think it's not great that the change is not backwards compatible anymore. |
In that I agree. @nodejs/tsc @nodejs/releasers, what should we do? |
I use This means a call to When applied to a
|
@ronag you should chime in on this one, because it looks like we might want to revert to the original behavior. |
I'll try to have a look next week. |
I'm not sure hwm of 0 makes any sense. Maybe the simple solution is to simply automatically change 0 to 1? |
I have been using it, and I will have to rework my Transform stream to Duplex stream if it is limited to 1, or drop node 16+ support. See #42457 (comment). |
The Release WG discussed this in today's meeting. The next regular 16 release is planned for sometime in July (after next week's security releases). It would be good to get some guidance from @nodejs/streams before then regarding whether to revert #40947, leave it as-is, or whether some other patch should land on v16.x. |
I did some digging, and found a potential fix that solves both regressions. The fix in #40947 is indeed faulty. The real issue is that The real fix seems to be to force the readable side of the transform stream to always call node/lib/internal/streams/transform.js Line 173 in 736a7d8
This can be forced with a Note I haven't tested this fix against the full node.js test suite, but it works for both my code and the testcase from #40947. |
Would you like to send a PR? |
@mcollina Yes, looking into making a PR right now. |
Hmm, it appears that my issue it not the same as this (at least the reproduction code). The reproduction code relies on calling As such my fix doesn't handle this exact issue, though it might fix the actual issue this is based on. |
Fixes: nodejs#40935 Refs: nodejs#40947 Refs: nodejs#42457
PR up in #43648. As per my previous comment, it doesn't fix the exact reproduction code from this issue, but it fixes the regression in my transform stream. |
Fixes: nodejs#40935 Refs: nodejs#40947 Refs: nodejs#42457
PR-URL: #43685 Refs: #42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #43685 Refs: #42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #43685 Refs: #42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #43685 Refs: #42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #43685 Refs: #42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs#43685 Refs: nodejs#42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: nodejs/node#43685 Refs: nodejs/node#42457 Refs: https://github.com/nodejs/node/pull/43648/files Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Version
16.14.2
Platform
x64
Subsystem
No response
What steps will reproduce the bug?
I wouldn't expect the
transform
method to be called, while the highWaterMark is already reached.How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Node 14 and older, backpressure is handled properly (even with highWaterMark: 0):
Expected output:
What do you see instead?
Additional information
When using
highWaterMark: 1
in Node 16.x, backpressure works as expected again.Did anything change around using
highWaterMark:0
in Node16? It doesn't seem backwards compatible.The text was updated successfully, but these errors were encountered: