Skip to content

Handle ECONNRESET possible on reused sockets#19

Merged
mjwwit merged 3 commits intomjwwit:masterfrom
Distributed-Compute-Labs:improvement/handle-econnreset
Oct 23, 2024
Merged

Handle ECONNRESET possible on reused sockets#19
mjwwit merged 3 commits intomjwwit:masterfrom
Distributed-Compute-Labs:improvement/handle-econnreset

Conversation

@YarnSaw
Copy link

@YarnSaw YarnSaw commented Oct 21, 2024

If a request reuses a socket (due to an agent with keepalive), it's possible for the client to error with ECONNRESET. This error has nothing to do with the message being invalid, the server not responding, etc, but rather just very misfortunate timings. In this case, retry the request instead of erroring the xhr request.

Test included that demonstrates the issue & how it's now handled.

If a request reuses a socket (due to an agent with keepalive), it's possible for the client to error with ECONNRESET. This error has nothing to do with the message being invalid, the server not responding, etc, but rather just very misfortunate timings. In this case, retry the request instead of erroring the xhr request
@mjwwit
Copy link
Owner

mjwwit commented Oct 23, 2024

Looks nice at first glance, thanks! I'll need some time to properly review this though, please bear with me.

Copy link
Owner

@mjwwit mjwwit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add this new test to the list in the package.json test script?

@mjwwit mjwwit merged commit 7be2aa6 into mjwwit:master Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants