【问题标题】:AWS ResetException - Failed to reset the request input streamAWS ResetException - 无法重置请求输入流
【发布时间】:2018-01-30 22:37:09
【问题描述】:

我目前正在编写一些将多部分对象上传到 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(因为这是 AWS 限制,所以上限为 5GB)。这似乎解决了这个问题,但现在同样的错误出现在新的地方。

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

任何帮助将不胜感激,

谢谢

泰德

【问题讨论】:

    标签: java amazon-web-services amazon-s3 inputstream aws-sdk


    【解决方案1】:

    对于那些正在寻找答案的人,解决方案是使用带有 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

    【讨论】:

      猜你喜欢
      • 2016-07-14
      • 2010-12-13
      • 1970-01-01
      • 1970-01-01
      • 2013-09-18
      • 2015-07-28
      • 2017-11-26
      • 2023-04-09
      • 2020-04-27
      相关资源
      最近更新 更多