我目前正在处理一些将多部分对象上传到 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,它可以在上传数据时标记/重置。
https://github.com/awsdocs/aws-java-developer-guide/blob/master/doc_source/best-practices.rst
关于java - AWS ResetException - 无法重置请求输入流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45821063/