Skip to content

Commit

Permalink
Don't leak Native CrtResources if error occurs during close
Browse files Browse the repository at this point in the history
  • Loading branch information
alexw91 authored and millems committed Sep 10, 2019
1 parent 326c0e0 commit 0878ffb
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
import software.amazon.awssdk.http.crt.internal.AwsCrtAsyncHttpStreamAdapter;
import software.amazon.awssdk.utils.AttributeMap;
import software.amazon.awssdk.utils.IoUtils;
import software.amazon.awssdk.utils.Logger;
import software.amazon.awssdk.utils.Validate;
import software.amazon.awssdk.utils.http.SdkHttpUtils;
Expand Down Expand Up @@ -250,12 +251,12 @@ public CompletableFuture<Void> execute(AsyncExecuteRequest asyncRequest) {
public void close() {
isClosed.set(true);
for (HttpConnectionPoolManager connPool : connectionPools.values()) {
connPool.close();
IoUtils.closeQuietly(connPool, log.logger());
}

while (ownedSubResources.size() > 0) {
CrtResource r = ownedSubResources.pop();
r.close();
IoUtils.closeQuietly(r, log.logger());
}
}

Expand Down

0 comments on commit 0878ffb

Please sign in to comment.