I'm facing a problem in my code when it tries to upload to AWS S3. Currently, many of the attempts fail due to the following error:
Caused by: com.amazonaws.ResetException: The request to the service failed with a retryable reason, but resetting the request input stream has failed. See exception.getExtraInfo or debug-level logging for the original failure that caused this retry.; If the request involves an input stream, the maximum stream buffer size can be configured via request.getRequestClientOptions().setReadLimit(int)
Looking at the AWS documentation for avoiding ResetExceptions, it notes that best practice is to "provide data by using a File or FileInputStream." In the code I'm using an InputStream, which FileInputStream extends. Would changing the type from InputStream to FileInputStream make any difference?
My alternative option would be to setReadLimit, but was wondering if the above change would be sufficient. Thank you!
I see you are using the AWS SDK for Java V1. This is not best practice and this SDK version is on the path to deprecation.
Announcing end-of-support for AWS SDK for Java v1.x effective December 31, 2025
This is stated in the doc topic you referenced. See note at top.
The Best practice to upload files using AWS SDK for Java V2 is to use Transfer Manager.
See docs here in the V2 Developer Guide:
Transfer files and directories with the Amazon S3 Transfer Manager
Here is the Code Example: