nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.47k stars 282 forks source link

Error: read ECONNRESET for Nodejs 20.3.0 (Never successful from this version) #4181

Open SEWeiTung opened 1 year ago

SEWeiTung commented 1 year ago

Details

Successfully on:

14.x (Windows, Ubunto, Mac), 16.x (Windows, Ubunto, Mac), 18.x (Windows, Ubunto, Mac) and 20.3.0 (Windows).

Failed on:

20.3.0 (Ubunto and Mac).

image


For more, please see: https://github.com/MaledongGit/egg/actions/runs/5234494571/jobs/9450695057

Node.js version

20.3.0

Example code

In the unit test:

        app.httpRequest()
          .get('/__koa_mock_scene_toolbox/hello')
          .expect(404, done);

if we ignored the snippet of codes above, the test can pass.

However even if I tried 3 or more times, it always gets me wrong. So please ignore this comment.

Operating system

Ubunto and Mac (with the latest version on GitHub for unit tests)

Scope

https://github.com/MaledongGit/egg/commit/25f214754541ff91a44f784260c530ec5f1db5be

(This is a 3-rd party repo and I've pasted the unit test part).

Module and version

No response


PS: I've seen such issues many times after searching in Node, however mine is DIFF from others in:

Other people may meet this problem by accident, but I met this problem this morning and tested several times, it always got me mad with the "failed" test.

Only the specific kind of version of Nodejs, as well as Linux or Mac.

Is there anything changed or ……?

Notice:This issue can be temporarily solved by adding "await" at each request, which means eash request MUST BE waiting for the resp of the app, and then everything gets fine....

miles170 commented 1 year ago

Have you found a workaround?

SEWeiTung commented 1 year ago

Have you found a workaround?

This issue can be temporarily solved by adding "await" at each request, which means eash request MUST BE waiting for the resp of the app, and then everything gets fine....

hermanbanken commented 7 months ago

We just also found this bug, and it seems to be introduced in this specific release.

I bisected:

node 16 works
node 18 works
node 19 works
node 20.0 works
node 20.2 works
=====
node 20.3 broken
node 20.6 broken
node 20.12 broken

But I'm not familiar with NodeJS internals, and the changelog (https://nodejs.org/en/blog/release/v20.3.0) isn't point out clear causes. I'm thinking maybe any of these:

hermanbanken commented 7 months ago

Related to https://github.com/ladjs/supertest/issues/709#issuecomment-1004883763. But I still don't know why this behaviour is introduced in Node 20.3. Something seems to disallow "many" (3?) connections, or concurrent servers. Setting maxConnections to 1 causes my tests to fail even earlier (after 1/6 supertest's instead of 3/6), but setting it to maxConnections > 3 doesn't increase the amount of tests working past 3.

RedYetiDev commented 3 months ago

Hi! Can you reproduce on the latest version of v20 with no dependencies? Also, is this only occurring in Gh actions?