Open tangwc opened 1 year ago
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
非常感谢提供pr,确实有这个问题,代码看起来也没问题。我们需要再加个测试验证下。
DoActionWithSigner,if AutoRetry may cause httpResponse not close. the httpResponse close logic is outside the for loop in responses.Unmarshal function. if AutoRetry open and response no err but statusCode wrong.in this cause httpResponse not close. 1、if client.buildRequestWithSigner has err,it will return then cause the problem 2、if continue,httpResponse will redefined then cause the problem so add defer httpResponse.Body.Close() in for loop to solve it.
DoActionWithSigner,自动重试时有可能造成没有关闭链接的问题。 当前逻辑,代码仅在for循环之外的responses.Unmarshal中处理了httpResponse的close。但是在for循环中的最后一个逻辑-自动重试会有问题。 如果AutoRetry开启,返回正常,但是返回的statusCode大于设定值,会进入自动重试逻辑。这个重试逻辑里有两种可能。 1、client.buildRequestWithSigner时报错,会return掉,导致httpResponse没有关闭。 2、continue时,httpResponse会重新赋值,导致老的httpResponse没有关闭。