-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
v16.5.0 change in async
writable._final()
behaviour
#39535
Comments
@nodejs/streams |
IMO the current behavior is correct. I think both async and cb should error like this but maybe not on v16 and docs might need some improvement. Maybe a v16 fix or revert? |
The quickest solution is do not use (We should probably put this in the doc). |
Ouch, yea, we are missing a |
For clarity, the above issue is something that affected a home-grown Gulp-based compiler used in production. We've already fixed the compiler itself, so it is now compatible with Node 16.5, so all is well for new releases. Unfortunately this behavior-change will block upgrading the machine that runs the compilation service to use Node >16.4 until we've patched all packages that use old versions of the compiler. Those packages are not owned by us, so it means convincing other teams to do work. I'd estimate it would delay our upgrade by around one year. This is inconvenient but not fatal - I pass it on not to request any particular action/work, purely for awareness. Ultimately, it looks like the behavior-change is the right way forwards, so it should go ahead either now or later. |
@mcollina A revert would be welcome, but it's not essential. The key is to avoid backporting the break to 14.x. There's no need to delay progress if you think we're the only party affected here. (I wrote the offending code so it's on me anyway 😉) |
Any progress on this issue @mcollina?
Does this go for other stream methods (like The latter might be hard when using NPM dependencies, so i'd rather have it "fixed" in Node.js where possible. Node version: 16.13.0 Update
This causes the final method to return a promise, which in turn will call the onFinish method two times. |
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: nodejs#39535
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: nodejs#39535
@ronag is on it. |
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: nodejs#39535
Fixed in afe460e |
Deprecate support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth, and never was documented. Refs: nodejs#39535
Deprecate support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth, and never was documented. Refs: nodejs#39535 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Deprecate support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth, and never was documented. Refs: #39535 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #40860 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Deprecate support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth, and never was documented. Refs: #39535 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #40860 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: nodejs#39535
Deprecate support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth, and never was documented. Refs: #39535 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #40860 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Deprecate support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth, and never was documented. Refs: #39535 Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #40860 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: nodejs#39535
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: #39535 PR-URL: #40773 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Remove support for returning thenables in stream implementation methods. This is causing more confusion and issues than it's worth. Refs: nodejs#39535 PR-URL: nodejs#40773 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Version
16.5.0
Platform
Microsoft Windows NT 10.0.19041.0 x64
Subsystem
stream
What steps will reproduce the bug?
As a result of #39329, a program that works in
v16.4.2
no longer works inv16.5.0
.The issue occurs when an
async
writable._final()
implementation explicitly calls the callback argument.In
v16.5.0
the callback-call and async-resolve combined result in[ERR_MULTIPLE_CALLBACK]: Callback called multiple times
in some circumstances.How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
What do you see instead?
Additional information
Documentation
I don't believe the
_final()
documentation sets expectations about the behaviour when it isasync
(or aPromise
returner). The source code before and after the change in question seems to point towards it being an intended means of implementing the_final()
.(Unless I've missed a part of the documentation): Users equipped only with this documentation and without looking at the implementation may be relying on the previous behaviour.
Types
The DefinitelyTyped types could potentially encode this expectation with an overload for
void
-returners having the argument, andPromise
-returners not having the argument.The text was updated successfully, but these errors were encountered: