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

Upgrade from node 16 to node 18, http requests hanging indefinitely #52871

Closed
alesk20 opened this issue May 7, 2024 · 1 comment
Closed

Upgrade from node 16 to node 18, http requests hanging indefinitely #52871

alesk20 opened this issue May 7, 2024 · 1 comment
Labels
http Issues or PRs related to the http subsystem.

Comments

@alesk20
Copy link

alesk20 commented May 7, 2024

Details

Hello, I recently updated my project (fastify server running on AWS) to Node 18 (previously Node 16). I'm experiencing something very strange: I have an unit test suite running with localstack (with lot of tests) and the same tests running succesfully with Node 16 now almost every time (but randomly) fail because it seems to me that the http connections to locastack service hang indefinitely, until my test suite timeout shut all down. I also experience that when this happen, my docker container automatically close before all tests are ended.

I experience also some strange timeouts on production mode, where I have a lot of interaction as http requests, database queries and sns publications: I particurarly experience strange timeouts on SNS publications (connections to SNS hang indefinitely) after 1-2 hours my server is running, and that eventually block the server which I must restart forcefully, beacause always more requests start to hang creating a sort of bottle neck.

I don't really know if the problem is with Node version, but I tried everything and I can say that both the test suite and the SNS publications never hang indefinitely with Node 16. As I switch to Node 18 I start to have the problem, starting simply with my unit tests.
The problem doesn't seem to reside on AWS or other libraries, because I also tried to mantain the same versions switching only Node, and the problem arise always only with version 18.

Do you have any idea of what could possibly be causing this? Did some node core http option change in Node 18 that may be causing this?

The problem occurs only with all Node 18 versions (I tried also the last one) and doesn't seem to occur either with Node greater versions, the 20 for example.

Node.js version

v.18

Operating system

Alpine Linux

@alesk20 alesk20 changed the title Upgrade from Node 16 to Node 18, http requests hanging indefinitely #4389 Upgrade from Node 16 to Node 18, http requests hanging indefinitely May 7, 2024
@RedYetiDev RedYetiDev added the http Issues or PRs related to the http subsystem. label May 9, 2024
@trivikr trivikr changed the title Upgrade from Node 16 to Node 18, http requests hanging indefinitely Upgrade from node 16 to node 18, http requests hanging indefinitely May 10, 2024
@alesk20
Copy link
Author

alesk20 commented May 17, 2024

I actually find out the problem, and it wasn't with nodejs version. It was actually the interaction with aws-sdk S3 client, it was not closing the socket connection if the s3 object body stream was not consumed, eventually leading to socket exhaustion.
The difference from node 16 and node 18 version was actually that I was also updating aws sdk version (the older s3 client did not return a stream for the S3 object body, so the problem never showed up).

@alesk20 alesk20 closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants