aws-sdk-js-v3
aws-sdk-js-v3 copied to clipboard
`node-http-handler` unexpected `TimeoutError` from socket
Checkboxes for prior research
- [X] I've gone through Developer Guide and API reference
- [X] I've checked AWS Forums and StackOverflow.
- [X] I've searched for previous similar issues and didn't find any solution.
Describe the bug
We are using the @aws-sdk/client-sso-oidc which looks to use @smithy/node-http-handler. The core of the issue looks to be with @smithy/node-http-handler.
In the user telemetry of our products AWS Toolkit for VS Code and Amazon Q for VS Code, we sometimes see the error TimeoutError, with the message Connection timed out after 0 ms. It looks to be coming from setSocketTimeout. In our attempt to fix this we set a value of 30_000 in the requestTimeout field which is eventually used here, and then we started to instead see Connection timed out after 30000 ms. This seems to validate that the problem is coming from setSocketTimeout
The docs say that the timeout should be disabled at 0ms.
SDK version number
- @aws-sdk/[email protected]
- @smithy/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
20+
Reproduction Steps
Cannot reproduce myself as it is sporadic, we see it in user telemetry though.
Minimal steps from my guess would be to:
- create a
NodeHttpHandlerinstance withrequestTimeoutat its default of 0 - create a server which responds with multiple chunks of data, but with some arbitrary delay between each chunk (eg 1000ms)
My guess is that since the request has multiple chunks you will get a TimeoutError since it will timeout before the next chunk is sent???? Below in the Additional Context section it seems like the socketTimeout should reset when new chunks are received.
Observed Behavior
Unexpected TimeoutError
Expected Behavior
Don't get a TimeoutError
Possible Solution
It looks that in setSocketTimeout we still set the timeout even if it is 0. If we return early will this be enough to fix the issue?
Additional Information/Context
- #6263 may be related
- I may be wrong, but shouldn't
setSocketTimeout()essentially reset its timeout whenever there is socket activity. I didn't see obvious code from a quick read. Maybe this is a separate issue in itself.
Hi @nkomonen-amazon - thanks for reaching out.
I'm not seeing any recent change to @smithy/node-http-handler that's relevant to what you're reporting, however you're on older version. See version history here. Can you try the recent version?
If issue persists, please provide minimal repro for us to further investigate. Feel free to cut internal SIM to the team as well. Best, John
Hey John!
The code that I assume has an issue is over a year old, so I don't think a newer version is the fix. The issue is happening for a subset of our users, so I cannot reproduce the problem myself.
I've opened a SIM ticket as well.
Thanks!
Thanks for your response. Our team has received an internal ticket for further investigation. However, to better understand and examine the reported behavior, we request that you provide us with a minimal reproducible code snippet or example that demonstrates the problem. Additionally, any relevant logs or diagnostic information that could offer more insights into the issue would be extremely helpful for our analysis.
This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.
.
Hey John!
The code that I assume has an issue is over a year old, so I don't think a newer version is the fix. The issue is happening for a subset of our users, so I cannot reproduce the problem myself.
I've opened a SIM ticket as well.
I was getting similar errors when doing local development with the SDK and it turned out to be a proxy / firewall issue.
Any attempts at direct connections to AWS would get cut off by the firewall and "time out" almost immediately.
Configuring the SDK to route traffic through the proxy when doing local development fixed the issue.
The exceptions being thrown weren't particularly helpful in troubleshooting the problem.
@timtucker-dte - appreciate your input and feedback!
@nkomonen-amazon - there's no updates from the team as issue isn't reproducible. is it still ongoing issue for you? Can you check if you might also have similar connection issue with proxy/firewall as mentioned above?
This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.