Skip to content
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

broken behavior of server.close and keepAlive in node v18.19.0 and above. Works as expected until v18.18.2 #52330

Closed
kumarrishav opened this issue Apr 2, 2024 · 1 comment
Labels
v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

Comments

@kumarrishav
Copy link
Contributor

Version

18.19.0

Platform

Darwin XXXXXXX 23.4.0 Darwin Kernel Version 23.4.0: Wed Feb 21 21:44:43 PST 2024; root:xnu-10063.101.15~2/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

Mentioned in this discussion:
https://github.com/orgs/nodejs/discussions/52224#discussioncomment-8987176

After digging more, I found that this behavior started in node v18.19.0 .

It worked fine until v18.18.2

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

There shouldn't be a broken behavior in minor release

What do you see instead?

failure

error Error: socket hang up
    at connResetException (node:internal/errors:720:14)
    at Socket.socketOnEnd (node:_http_client:525:23)
    at Socket.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ECONNRESET'
}
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: socket hang up
    at connResetException (node:internal/errors:720:14)
    at Socket.socketOnEnd (node:_http_client:525:23)
    at Socket.emit (node:events:529:35)
    at endReadableNT (node:internal/streams/readable:1400:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  code: 'ECONNRESET'
}

Additional information

No response

@kumarrishav kumarrishav changed the title broken behavior of server.close and keep-alive in node v18.19.0. Works as expected until v18.18.2 broken behavior of server.close and keepAlive in node v18.19.0. Works as expected until v18.18.2 Apr 2, 2024
@kumarrishav
Copy link
Contributor Author

kumarrishav commented Apr 2, 2024

Appreciate any help/input here. Thank you

CC: @bnoordhuis

is it duplicate of #51677

Can someone explain expected behavior?

This is my expectation:
After server.close, i want to keep the existing connection until the keepAlive timeout and let user handle the behavior (by sending connection: close for future request on existing connection) .

It appears that keep-alive timeout doesn't has much value after server.close?

What's the new behavior, if ongoing connection - not idle one (while server.close occurs) takes more time than keepAlive. I assume it won't exist untill that complete unless forced close. right?

@kumarrishav kumarrishav changed the title broken behavior of server.close and keepAlive in node v18.19.0. Works as expected until v18.18.2 broken behavior of server.close and keepAlive in node v18.19.0 and above. Works as expected until v18.18.2 Apr 2, 2024
kumarrishav added a commit to kumarrishav/node that referenced this issue Apr 2, 2024
Correcting the nodejs#50194 backporting mistake. server.closeIdleConnections shouldn't be called while server.close in node v18. This behavior is for node v19 and above.

fixes: nodejs#52330, nodejs#51677,
kumarrishav added a commit to kumarrishav/node that referenced this issue Apr 2, 2024
Correcting the nodejs#50194 backporting mistake.
closeIdleConnections shouldn't be called while server.close in node v18.
This behavior is for node v19 and above.

fixes: nodejs#52330, nodejs#51677,
kumarrishav added a commit to kumarrishav/node that referenced this issue Apr 2, 2024
….\n Correcting the nodejs#50194 backporting mistake.\n closeIdleConnections shouldnot be called while server.close in node v18.\n This behavior is for node v19 and above.\n fixes: nodejs#52330, nodejs#51677
kumarrishav added a commit to kumarrishav/node that referenced this issue Apr 2, 2024
Correcting the nodejs#50194 backporting mistake.
closeIdleConnections shouldnot be called while server.close in node v18.
This behavior is for node v19 and above.

fixes: nodejs#52330, nodejs#51677
kumarrishav added a commit to kumarrishav/node that referenced this issue Apr 2, 2024
Correcting the nodejs#50194 backporting mistake.
closeIdleConnections shouldnot be called while server.close in node v18.
This behavior is for node v19 and above.

fixes: nodejs#52330, nodejs#51677
kumarrishav added a commit to kumarrishav/node that referenced this issue Apr 2, 2024
Correcting the nodejs#50194 backporting mistake.
closeIdleConnections shouldnot be called while server.close in node v18.
This behavior is for node v19 and above.

fixes: nodejs#52330, nodejs#51677
richardlau pushed a commit that referenced this issue Apr 17, 2024
Correcting the #50194 backporting mistake.
closeIdleConnections shouldnot be called while server.close in node v18.
This behavior is for node v19 and above.

Fixes: #52330
Fixes: #51677
PR-URL: #52336
Refs: #50194
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
@richardlau richardlau added the v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch. label May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.
Projects
None yet
Development

No branches or pull requests

2 participants