-
Notifications
You must be signed in to change notification settings - Fork 584
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
SocketError: other side closed #583 #2412
Comments
I can still reproduce this error, please dont close it |
|
Can you provide an |
@metcoder95 hi, what I observed for now is:
I'd hope to have a minimum reproducible example but it's very hard for now |
I'm using undici@5.24.0, I just tried v5.27.0 and I still have the same issue. FYI, this happened while using hardhat framework |
If I execute |
The error you are referring to its for node process taking longer to close due to network constraints. Here it seems is that the remote server closed the connection. Where are you trying to connect to and how?? |
I try to connect to a local hardhat node using ethers library |
Can you provide an |
This error is still around in node It doesn't however occur at all using the bun runtime. |
Without a repro there is nothing we can do here. |
@ronag here is the reproducible example: https://github.com/nordluf/fetch-socket-closed-example |
I've been able to eliminate this issue by limiting the number of connections the node process can make to the server. NodeJS by default uses too many ports of the host i.e. opens too many connections to the server and at some point is not able to handle them or the OS interefers and the connections break. In my case, it used over 16_000 connections. The number of connections can be limited using HTTP agents. Following is the snippet from my code that has fixed this issue.
You can set the number of connections based on your needs. You can monitor the number of ports used by the
I didn't face this issue at all when using the Bun runtime for JS. I identified this by analyzing the packets between the client & server via Wireshark. There's also Charles Proxy that can help you analyze the traffic flow. |
@WilfredAlmeida in the example I provided above it doesn't help |
Bug Description
Reproducible By
Expected Behavior
Logs & Screenshots
Environment
Additional context
The text was updated successfully, but these errors were encountered: