Skip to content

Conversation

@mmarchini
Copy link
Contributor

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
@mmarchini mmarchini merged commit 71c7f49 into restify:master Sep 29, 2021
@mmarchini mmarchini deleted the nodejs-16 branch September 29, 2021 03:59
josephharrington added a commit that referenced this pull request Jan 31, 2022
In #1880, we switched from using the close event on `req` to close on
`req.socket`. This addressed the intended issue but can trigger frequent
warnings when keep-alive is used due to a listener being added for each
request on the same socket.

By using the close event on `res` instead, we address both the issue of
event ordering in Node.js >= 16 that the original change was targeting
and the event emitter warning leak.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant