help icon indicating copy to clipboard operation
help copied to clipboard

Different socket connection behaviour between Nodejs 18 and Nodejs 20

Open lamhoangpham20 opened this issue 4 months ago • 0 comments

Node.js Version

v20.16.0

NPM Version

v10.8.1

Operating System

Darwin macOS ARM64

Subsystem

http

Description

I have stress-tested my NodeJS server in Nodejs 18 and Nodejs 20 with Locust and I received ConnectionResetError with v20 but not v18. Is there any workaround with this issue

Image

Minimal Reproduction

Condition:

  • Server is running with Express Nodejs
  • 2000 concurrent requests per second
  • HTTP protocol
  • The logic behind the API route has asynchronous functions.

Output

Result:

  • When testing against the express server running in NodeJS 20, about 1% of the requests got ConnectionResetError(54, 'Connection reset by peer') error in Locust.
  • When testing against the express server running in NodeJS 18, there is no error found from the client request

I also try to configure the keepalivetimeout in express but there is no difference.

With Nodejs v20

Image Image

With Nodejs v18

Image

Before You Submit

  • [x] I have looked for issues that already exist before submitting this
  • [x] My issue follows the guidelines in the README file, and follows the 'How to ask a good question' guide at https://stackoverflow.com/help/how-to-ask

lamhoangpham20 avatar Sep 16 '25 06:09 lamhoangpham20