-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
connection reset when using https server/client combi without keepalive #23128
Comments
Are you running Node inside a VM? |
@bzoz No, I did not run it in a VM. Windows 10. Version 1803, build 17134.286. |
@nodejs/http @nodejs/platform-windows |
Possibly related. After we upgraded our servers from node 14 to node 16 we started gettings errors when connecting to an external API using mutual TLS that I suspect is running Windows:
We solved this and got the requests working again by enabling keepAlive: const agent = new https.Agent({
cert,
key,
keepAlive: true,
})
const response = await fetch(url, {
agent,
method: 'post', Hopefully this can help others having the same issue. I can probably put together a small test case if somebody is interested. |
I think I'm seeing resets with same or similar root cause on Ubuntu and OSX on several node version ranging from Node 14 to Node 20. Here is an example that reproduces it node-tcp-resets.zip. I have also attached captured dumps from Resets seems to always happen after the http communication is finished, so it doesn't bubble up to node as an error. Both server and client sends resets with varying rates across versions. Sometimes there are even TCP retransmissions going on. Node 20 seems to behave slightly differently -- resets are sent almost exclusively from the client to the server and also if the server doesn't read the incoming data, connection reset from the client is received in the event handler. Another way how to prevent it seems to be We suspect that something has changed between Node 18.12.1 and 18.13.0 because we see a lot more connection resets in communication between two services in production. When the https client is running Node 18.12.1 we see low number of resets, when it's running 18.13.0 we see about 20x more resets. Everything, except the version of node on https client is equal. We are not certain at this point if there's the same cause for resets on prod and the example that I've attached or not. Here is an output from the attached example:
|
We noticed that there are unexpected RST packages when inspecting the connection with Wireshark.
This are our findings for now:
Node does not trigger any error event. Data transfer goes well, but the connection is not closed correctly. The connection ends with:
client -> server: ACK
server -> client: FIN, ACK
client -> server: ACK
TLSv1.2: Encrypted Alert
server -> Client: RST, ACK
Test code:
client:
Server:
The text was updated successfully, but these errors were encountered: