-
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
Undocumented breaking change on v16.0.0 #38924
Comments
I would guess that the |
From
So the (documented) intention is not that the stream was closed, but the underlying [socket] connection. That's still our documentation on v16, which makes me think this might've been an unintentional change. cc @nodejs/tsc @nodejs/http |
The current behavior is correct per se and totally intentional to be compliant with streams. I would rather update the documentation which is wrong IMO. The old behavior basically means that using it in a streams api is undefined behavior from the user’s perspective. |
It needs to be both documented as a breaking change in our changelogs and the documentation needs to be updated then. Right now this is a breaking change that is not documented anywhere. In which PR was it introduced? |
I just added a comment before here thinking this was a breaking change on a minor... 😳 Don't mind me... |
If we don't find the PR which introduced the change, it might land soon by mistake on v14.x. |
I’m pretty sure the Pr was semver. Can’t find it at the moment. Will look a bit more tonight. |
Wait. This is on IncomingMessage which is a Readable. I’m very surprised if the behavior is different on node 14. |
It might be doe autoDestroy true change we did. |
It was only reverted on v15 and then made it into v16 as a semver major. I think the fix here is docs and maybe missing in change log. |
Oh I see, it was actually landed initially as semver-minor. |
It's not only about major changes. If something lands on |
The close event from the request object is not guaranteed to fire on the same order across major versions of Node.js, the more accurate way to look if the connection was closed is to listen to the event on the socket. Fixes tests on v16. Ref: nodejs/node#38924
The close event from the request object is not guaranteed to fire on the same order across major versions of Node.js, the more accurate way to look if the connection was closed is to listen to the event on the socket. Fixes tests on v16. Ref: nodejs/node#38924
The close event from the request object is not guaranteed to fire on the same order across major versions of Node.js, the more accurate way to look if the connection was closed is to listen to the event on the socket. Fixes tests on v16. Ref: nodejs/node#38924
* Bump node to ^16 * fix comment * use jest timers * bump mock-fs * Fix core type errors * Unskipping tests that work on my machine * skip new unhandled promise rejection * Fix Nodejs v16 regression due to nodejs/node#38924 * Fix failing concurrent connections collector test * Fix types after merge from master * update servicenow test * Skip unhandledRejection tests * Skip tests with unhandled promise rejection * Fix discover jest failures * bump node to 16.11.1 * revert timeout increase * skip unhandled promise rejection * rm jest import * skip unhandled promise rejection Co-authored-by: Rudolf Meijering <skaapgif@gmail.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Tim Roes <tim.roes@elastic.co>
I've just run into this as well (and this is not the only issue that has been opened for this exact breaking change). I'm using the I don't think I can listen to Edit: nvm, I guess listening for the socket close seems to do what I need with some tweaking. |
I think nothing else is needed on this. Can we close the issue? |
I don't think the docs and changelogs were updated with the new behavior yet (unless I missed it). |
Oh, I missed that. I'll take care of it. |
PR-URL: nodejs#42521 Fixes: nodejs#38924 Refs: nodejs#33035 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs#42521 Fixes: nodejs#38924 Refs: nodejs#33035 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
PR-URL: nodejs/node#42521 Fixes: nodejs/node#38924 Refs: nodejs/node#33035 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@Prinzhorn What was the tweaking you did to make this working reliably? |
@Fabioni I only needed this to work in a specific environment (Electron + HTTP/1.1). Take a look at the implementation of https://www.npmjs.com/package/fastify-racing for a more general approach |
What steps will reproduce the bug?
index.js
and run it.curl localhost:8080
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Prior to v16, the server would print the output below and hang.
What do you see instead?
On v16, the server prints the output below and hang.
On both cases curl doesn't exit while waiting for a response. Note that 2 is being called because
close
is being emitted even though the connection is not closed yet. I'm not sure if that is intended behavior or not, but I couldn't find anything in the changelog suggesting this was an intentional change. Furthermore, it's a breaking change and it should be documented as such.Additional information
The example above is an overly simplification of a situation I've stumbled upon while investigating failing restify tests on Node.js v16. The failing test in question is this, and the failure happens because restify expects close to only be called when the connection closes.
The text was updated successfully, but these errors were encountered: