Skip to content

Different socket connection behaviour between Nodejs 18 and Nodejs 20 #5101

@lamhoangpham20

Description

@lamhoangpham20

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

  • I have looked for issues that already exist before submitting this
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions