You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "adutra (via GitHub)" <gi...@apache.org> on 2025/03/18 13:01:32 UTC

[PR] Core: child HTTPClient should not close shared resources [iceberg]

adutra opened a new pull request, #12566:
URL: https://github.com/apache/iceberg/pull/12566

   Currently, when a child `HTTPClient`, obtained via `RESTClient.withAuthSession()`, is closed, that also closes its parent's shared resources. As a consequence, the parent is also effectively closed and becomes unusable.
   
   This PR fixes that by making sure that a child `HTTPClient` only closes its own resources, leaving any shared resources to be closed exclusively by the "root" instance.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2001476493


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -83,6 +83,7 @@ public class HTTPClient extends BaseHTTPClient {
   private final Map<String, String> baseHeaders;
   private final ObjectMapper mapper;
   private final AuthSession authSession;
+  private final boolean root;

Review Comment:
   nit: maybe `isRootClient`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks merged PR #12566:
URL: https://github.com/apache/iceberg/pull/12566


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2001478739


##########
core/src/test/java/org/apache/iceberg/rest/TestHTTPClient.java:
##########
@@ -323,6 +325,19 @@ public void testInvalidTimeout(String timeoutMsType) {
         .hasMessage(String.format("duration must not be negative: %s", invalidNegativeTimeoutMs));
   }
 
+  @Test
+  public void testCloseChild() throws IOException {
+    AuthSession authSession = mock(AuthSession.class);
+    try (RESTClient child = restClient.withAuthSession(authSession)) {
+      assertThat(child).isNotNull().isNotSameAs(restClient);
+    }

Review Comment:
   nit: newline after this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2001492477


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -324,7 +327,10 @@ public void close() throws IOException {
         authSession.close();
       }
     } finally {
-      httpClient.close(CloseMode.GRACEFUL);
+      if (root) {
+        // Only close the underlying Apache HTTP client if this is a root HTTPClient.
+        httpClient.close(CloseMode.GRACEFUL);

Review Comment:
   also do we need to revisit all places that use `client.withAuthSession(..)` to make sure those clients are properly closed?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2012419084


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -250,25 +251,28 @@ public SdkHttpFullRequest sign(
     } else {
       Map<String, String> responseHeaders = Maps.newHashMap();
       Consumer<Map<String, String>> responseHeadersConsumer = responseHeaders::putAll;
-      S3SignResponse s3SignResponse =
-          httpClient()
-              .withAuthSession(authSession())
-              .post(
-                  endpoint(),
-                  remoteSigningRequest,
-                  S3SignResponse.class,
-                  Map.of(),
-                  ErrorHandlers.defaultErrorHandler(),
-                  responseHeadersConsumer);
-
-      signedComponent =
-          ImmutableSignedComponent.builder()
-              .headers(s3SignResponse.headers())
-              .signedURI(s3SignResponse.uri())
-              .build();
-
-      if (canBeCached(responseHeaders)) {
-        SIGNED_COMPONENT_CACHE.put(cacheKey, signedComponent);
+      try (RESTClient restClient = httpClient().withAuthSession(authSession())) {

Review Comment:
   I would agree with @nastra here.  The http client is registered with the catalog's closeable group and the lifecycle should track with the catalog.  All the extra no-op try/catches are confusing and I don't think we should include them because that's not the intent (though it may make an IDE complain about unclosed resources).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#issuecomment-2751894385

   > @adutra I'm unclear on the motivation here. Is there a place where we are closing the client or is the intention to be more preventative so that if something were to close the client, it would close resources for everyone?
   
   The latter. If a child HTTP client is closed by its owner, be it a catalog or another component, the "root" HTTP client should not be closed as it might be still in use.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2012516843


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -250,25 +251,28 @@ public SdkHttpFullRequest sign(
     } else {
       Map<String, String> responseHeaders = Maps.newHashMap();
       Consumer<Map<String, String>> responseHeadersConsumer = responseHeaders::putAll;
-      S3SignResponse s3SignResponse =
-          httpClient()
-              .withAuthSession(authSession())
-              .post(
-                  endpoint(),
-                  remoteSigningRequest,
-                  S3SignResponse.class,
-                  Map.of(),
-                  ErrorHandlers.defaultErrorHandler(),
-                  responseHeadersConsumer);
-
-      signedComponent =
-          ImmutableSignedComponent.builder()
-              .headers(s3SignResponse.headers())
-              .signedURI(s3SignResponse.uri())
-              .build();
-
-      if (canBeCached(responseHeaders)) {
-        SIGNED_COMPONENT_CACHE.put(cacheKey, signedComponent);
+      try (RESTClient restClient = httpClient().withAuthSession(authSession())) {

Review Comment:
   OK removing the try with resources blocks



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2011668723


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -250,25 +251,28 @@ public SdkHttpFullRequest sign(
     } else {
       Map<String, String> responseHeaders = Maps.newHashMap();
       Consumer<Map<String, String>> responseHeadersConsumer = responseHeaders::putAll;
-      S3SignResponse s3SignResponse =
-          httpClient()
-              .withAuthSession(authSession())
-              .post(
-                  endpoint(),
-                  remoteSigningRequest,
-                  S3SignResponse.class,
-                  Map.of(),
-                  ErrorHandlers.defaultErrorHandler(),
-                  responseHeadersConsumer);
-
-      signedComponent =
-          ImmutableSignedComponent.builder()
-              .headers(s3SignResponse.headers())
-              .signedURI(s3SignResponse.uri())
-              .build();
-
-      if (canBeCached(responseHeaders)) {
-        SIGNED_COMPONENT_CACHE.put(cacheKey, signedComponent);
+      try (RESTClient restClient = httpClient().withAuthSession(authSession())) {

Review Comment:
   given that we're not closing anything I would not wrap this in a try-with-resources here, because I had to go over this code a few times to make sure we're not causing a performance degradation, since this part will be called quite often during signing. Other readers of the code might have the same thought and arrive at the same conclusion after studying the code and that's why I think it's better to not use try-with-resources here (and most likely in all of the places in the `RESTSessionCatalog`. 
   @danielcweeks would love to hear what you think about this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2001611507


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -324,7 +327,10 @@ public void close() throws IOException {
         authSession.close();
       }
     } finally {
-      httpClient.close(CloseMode.GRACEFUL);
+      if (root) {
+        // Only close the underlying Apache HTTP client if this is a root HTTPClient.
+        httpClient.close(CloseMode.GRACEFUL);

Review Comment:
   I went ahead and implemented your suggestion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2001506536


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -324,7 +327,10 @@ public void close() throws IOException {
         authSession.close();
       }
     } finally {
-      httpClient.close(CloseMode.GRACEFUL);
+      if (root) {
+        // Only close the underlying Apache HTTP client if this is a root HTTPClient.
+        httpClient.close(CloseMode.GRACEFUL);

Review Comment:
   I thought about that, but we need to proceed carefully: if you close the client returned by `client.withAuthSession(..)`, its auth session will be closed as well. And that is not correct, if the session is a contextual or table session that was cached.
   
   If we want to go down that route, we need to NEVER close the auth session inside HTTPClient.
   
   Are you OK with that? I can make the changes if so. (In fact, it's probably the most correct thing to do now that I think of it.)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#issuecomment-2748345745

   @nastra I just rebased, can I have another review please?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2001482330


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -324,7 +327,10 @@ public void close() throws IOException {
         authSession.close();
       }
     } finally {
-      httpClient.close(CloseMode.GRACEFUL);
+      if (root) {
+        // Only close the underlying Apache HTTP client if this is a root HTTPClient.
+        httpClient.close(CloseMode.GRACEFUL);

Review Comment:
   thanks for fixing this. I've noticed this during review and thought closing the parent instance is implicitly prevented, but I guess I missed this `finally` block



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2011564655


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -250,25 +251,28 @@ public SdkHttpFullRequest sign(
     } else {
       Map<String, String> responseHeaders = Maps.newHashMap();
       Consumer<Map<String, String>> responseHeadersConsumer = responseHeaders::putAll;
-      S3SignResponse s3SignResponse =
-          httpClient()
-              .withAuthSession(authSession())
-              .post(
-                  endpoint(),
-                  remoteSigningRequest,
-                  S3SignResponse.class,
-                  Map.of(),
-                  ErrorHandlers.defaultErrorHandler(),
-                  responseHeadersConsumer);
-
-      signedComponent =
-          ImmutableSignedComponent.builder()
-              .headers(s3SignResponse.headers())
-              .signedURI(s3SignResponse.uri())
-              .build();
-
-      if (canBeCached(responseHeaders)) {
-        SIGNED_COMPONENT_CACHE.put(cacheKey, signedComponent);
+      try (RESTClient restClient = httpClient().withAuthSession(authSession())) {

Review Comment:
   this effectively closes nothing in particular (unless I'm missing something)?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2011562687


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -319,11 +322,9 @@ protected <T extends RESTResponse> T execute(
 
   @Override
   public void close() throws IOException {
-    try {
-      if (authSession != null) {

Review Comment:
   when is the auth session being closed then? I currently don't see any code that would close the auth session anywhere or am I missing something?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2011668723


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -250,25 +251,28 @@ public SdkHttpFullRequest sign(
     } else {
       Map<String, String> responseHeaders = Maps.newHashMap();
       Consumer<Map<String, String>> responseHeadersConsumer = responseHeaders::putAll;
-      S3SignResponse s3SignResponse =
-          httpClient()
-              .withAuthSession(authSession())
-              .post(
-                  endpoint(),
-                  remoteSigningRequest,
-                  S3SignResponse.class,
-                  Map.of(),
-                  ErrorHandlers.defaultErrorHandler(),
-                  responseHeadersConsumer);
-
-      signedComponent =
-          ImmutableSignedComponent.builder()
-              .headers(s3SignResponse.headers())
-              .signedURI(s3SignResponse.uri())
-              .build();
-
-      if (canBeCached(responseHeaders)) {
-        SIGNED_COMPONENT_CACHE.put(cacheKey, signedComponent);
+      try (RESTClient restClient = httpClient().withAuthSession(authSession())) {

Review Comment:
   given that we're not closing anything I would not wrap this in a try-with-resources here, because I had to go over this code a few times to make sure we're not causing a performance degradation, since this part will be called quite often during signing. Other readers of the code might have the same thought and arrive at the same conclusion after studying the code and that's why I think it's better to not use try-with-resources here (and most likely in all of the places in the `RESTSessionCatalog`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra closed pull request #12566: Core: child HTTPClient should not close shared resources
URL: https://github.com/apache/iceberg/pull/12566


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "danielcweeks (via GitHub)" <gi...@apache.org>.
danielcweeks commented on PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#issuecomment-2751738230

   @adutra I'm unclear on the motivation here.  Is there a place where we are closing the client or is the intention to be more preventative so that if something were to close the client, it would close resources for everyone?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2011600401


##########
aws/src/main/java/org/apache/iceberg/aws/s3/signer/S3V4RestSignerClient.java:
##########
@@ -250,25 +251,28 @@ public SdkHttpFullRequest sign(
     } else {
       Map<String, String> responseHeaders = Maps.newHashMap();
       Consumer<Map<String, String>> responseHeadersConsumer = responseHeaders::putAll;
-      S3SignResponse s3SignResponse =
-          httpClient()
-              .withAuthSession(authSession())
-              .post(
-                  endpoint(),
-                  remoteSigningRequest,
-                  S3SignResponse.class,
-                  Map.of(),
-                  ErrorHandlers.defaultErrorHandler(),
-                  responseHeadersConsumer);
-
-      signedComponent =
-          ImmutableSignedComponent.builder()
-              .headers(s3SignResponse.headers())
-              .signedURI(s3SignResponse.uri())
-              .build();
-
-      if (canBeCached(responseHeaders)) {
-        SIGNED_COMPONENT_CACHE.put(cacheKey, signedComponent);
+      try (RESTClient restClient = httpClient().withAuthSession(authSession())) {

Review Comment:
   Yes, this is purely for correctness.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org


Re: [PR] Core: child HTTPClient should not close shared resources [iceberg]

Posted by "adutra (via GitHub)" <gi...@apache.org>.
adutra commented on code in PR #12566:
URL: https://github.com/apache/iceberg/pull/12566#discussion_r2011601694


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -319,11 +322,9 @@ protected <T extends RESTResponse> T execute(
 
   @Override
   public void close() throws IOException {
-    try {
-      if (authSession != null) {

Review Comment:
   The auth session being provided externally, it's the caller's responsibility to close it now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org