AWS ResetException - 无法重置请求输入流

AWS ResetException - Failed to reset the request input stream

我目前正在编写一些将多部分对象上传到 S3 的代码,我 运行 遇到了这个错误:

Caused by: com.amazonaws.ResetException: Failed to reset the request input stream;  If the request involves an input stream, the maximum stream buffer size can be configured via request.getRequestClientOptions().setReadLimit(int)

最初将 readLimit 设置为 5MB。我更改了代码,以便输入流上的 ReadLimit 是对象大小,四舍五入到最接近的 5MB(上限为 5GB,因为那是 AWS 限制)。这似乎解决了问题,但现在新的地方出现了同样的错误。

对于将 readLimit 设置为什么值以获得最大可靠性,有没有人有任何建议?

如有任何帮助,我们将不胜感激,

谢谢

泰德

对于那些寻找答案的人,解决方案是使用带有 BackOffStrategy 的 RetryPolicy。回退策略会缓慢增加连接尝试之间的时间量。

http://docs.aws.amazon.com/general/latest/gr/api-retries.html

此外,如果您使用退避策略,则需要使用兼容的 FileStreamer,它可以在上传数据时 Mark/Reset。

https://github.com/awsdocs/aws-java-developer-guide/blob/master/doc_source/best-practices.rst