You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Pigueiras (via GitHub)" <gi...@apache.org> on 2026/06/10 08:23:01 UTC

[PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Pigueiras opened a new pull request, #10478:
URL: https://github.com/apache/ozone/pull/10478

   ## What changes were proposed in this pull request?
   HDDS-15522. Make RpcClient close idempotent
   
   Guard RpcClient cleanup so repeated close calls return before releasing ContainerClientMetrics again. This keeps the metrics acquire/release pairing per client instance and avoids shutdown warnings when ViewFS or filesystem cache cleanup closes the same client more than once.
   
   ## How was this patch tested?
   
   We have built it and deployed it in our client nodes, and we can't see anymore the following warning when executing operations in an Ozone viewfs mount:
   
   ```
   $ hdfs dfs -ls /ozone
   ...
   26/06/10 10:06:13 WARN util.ShutdownHookManager: ShutdownHook 'ClientFinalizer' failed, java.util.concurrent.ExecutionException: java.lang.IllegalStateException: This metrics class is not used.
   java.util.concurrent.ExecutionException: java.lang.IllegalStateException: This metrics class is not used.
           at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
           at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:205)
           at org.apache.hadoop.util.ShutdownHookManager.executeShutdown(ShutdownHookManager.java:124)
           at org.apache.hadoop.util.ShutdownHookManager$1.run(ShutdownHookManager.java:95)
   Caused by: java.lang.IllegalStateException: This metrics class is not used.
           at org.apache.hadoop.hdds.scm.ContainerClientMetrics.release(ContainerClientMetrics.java:96)
           at org.apache.hadoop.ozone.client.rpc.RpcClient.close(RpcClient.java:1892)
           at org.apache.hadoop.ozone.client.OzoneClient.close(OzoneClient.java:122)
           at org.apache.hadoop.fs.ozone.BasicRootedOzoneClientAdapterImpl.close(BasicRootedOzoneClientAdapterImpl.java:372)
           at org.apache.hadoop.fs.ozone.BasicRootedOzoneFileSystem.close(BasicRootedOzoneFileSystem.java:225)
           at org.apache.hadoop.fs.viewfs.ViewFileSystem$InnerCache.closeAll(ViewFileSystem.java:156)
           at org.apache.hadoop.fs.viewfs.ViewFileSystem.close(ViewFileSystem.java:1936)
           at org.apache.hadoop.fs.FileSystem$Cache.closeAll(FileSystem.java:3816)
           at org.apache.hadoop.fs.FileSystem$Cache$ClientFinalizer.run(FileSystem.java:3833)
           at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
           at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
           at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
           at java.base/java.lang.Thread.run(Thread.java:829)
   ```


-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on PR #10478:
URL: https://github.com/apache/ozone/pull/10478#issuecomment-4687682148

   Another direction is to check and make sure each of the resource release are idempotent, thus close itself automatically becomes idempotent.
   
   Also we can combine the suggestions above to this PR which also handles the exception and release resources properly.


-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3386657332


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -222,6 +223,7 @@ public class RpcClient implements ClientProtocol {
   private final MemoizedSupplier<ExecutorService> ecReconstructExecutor;
   private final ContainerClientMetrics clientMetrics;
   private final MemoizedSupplier<ExecutorService> writeExecutor;
+  private final AtomicBoolean closed = new AtomicBoolean(false);

Review Comment:
   Setting `closed` to `true` at the very start of `close()` can prevent subsequent `close()` calls from completing cleanup if the first `close()` exits early due to an exception thrown later in the method (since later calls will now return immediately). A more robust pattern is to (1) guard against concurrent re-entry (eg with a separate `closing` flag/lock), (2) attempt all cleanup steps while collecting/deferring exceptions, and (3) only mark `closed = true` once cleanup has been attempted (eg in a `finally` after the full shutdown sequence), so failure in one close step doesn’t permanently skip the remaining cleanup.



##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1948,6 +1950,9 @@ private OmKeyInfo getKeyInfo(OmKeyArgs keyArgs) throws IOException {
 
   @Override
   public void close() throws IOException {
+    if (!closed.compareAndSet(false, true)) {
+      return;
+    }

Review Comment:
   Setting `closed` to `true` at the very start of `close()` can prevent subsequent `close()` calls from completing cleanup if the first `close()` exits early due to an exception thrown later in the method (since later calls will now return immediately). A more robust pattern is to (1) guard against concurrent re-entry (eg with a separate `closing` flag/lock), (2) attempt all cleanup steps while collecting/deferring exceptions, and (3) only mark `closed = true` once cleanup has been attempted (eg in a `finally` after the full shutdown sequence), so failure in one close step doesn’t permanently skip the remaining cleanup.



-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "Pigueiras (via GitHub)" <gi...@apache.org>.
Pigueiras commented on PR #10478:
URL: https://github.com/apache/ozone/pull/10478#issuecomment-4689710947

   Thanks for the review, really appreciated. I pushed an updated proposal here: https://github.com/Pigueiras/ozone/commit/488956cb522855ffdb773672324b19ed77902a47, not sure if it addresses everything you suggested.
   
   I tried to follow @peterxcli idea and added a `ContainerClientMetrics.Handle`, so `RpcClient` owns a handle for its metrics acquisition and closes that instead of calling `ContainerClientMetrics.release()` directly.
   
   I also tried to include @amaliujia point by making this release path idempotent, and by using `IOUtils.cleanupWithLogger(...)` so the rest of the close cleanup can still run if one step has a problem.
   
   Just to be transparent, this PR is AI-assisted. I understand the metrics double-release problem at a high level, but I'm not very familiar with the cleanup lifecycle here, so please feel free to suggest specific changes. Also totally fine if you think there's a simpler/faster way to handle it and want to steer this differently if you want to do a separate PR 😄 


-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

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


-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3394234038


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########


Review Comment:
   what if we add a metrics handle for `ContainerClientMetrics`?
   ```java
   /**
    * Handle for ContainerClientMetrics.
    */
   public static final class Handle implements AutoCloseable {
     private final ContainerClientMetrics metrics;
     private final AtomicBoolean closed = new AtomicBoolean(false);
   
     private Handle(ContainerClientMetrics metrics) {
       this.metrics = metrics;
     }
   
     public ContainerClientMetrics metrics() {
       return metrics;
     }
   
     @Override
     public void close() {
       if (closed.compareAndSet(false, true)) {
         release();
       }
     }
   }
   
   public static Handle acquireHandle() {
     return new Handle(acquire());
   }
   ```
   
   so inside the `RpcClient`:
   ```java
   public RpcClient(ConfigurationSource conf, String omServiceId) throws IOException {
     // ...
     this.clientMetricsHandle = ContainerClientMetrics.acquireHandle();
     this.clientMetrics = clientMetricsHandle.metrics();
     // ...
   }
   
   @Override
   public void close() throws IOException {
     // ...
   
     // ContainerClientMetrics.release();
     clientMetricsHandle.close();
   }
   ```



-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "yandrey321 (via GitHub)" <gi...@apache.org>.
yandrey321 commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3390341425


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1948,6 +1950,9 @@ private OmKeyInfo getKeyInfo(OmKeyArgs keyArgs) throws IOException {
 
   @Override
   public void close() throws IOException {
+    if (!closed.compareAndSet(false, true)) {
+      return;
+    }

Review Comment:
   Close should not require retry and should not throw exceptions. Since there are multiple steps each step should take care about error handling and let the other steps to release 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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3405343635


##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -18,14 +18,26 @@
 package org.apache.hadoop.ozone.client.rpc;
 
 import static org.apache.hadoop.ozone.client.rpc.RpcClient.validateOmVersion;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
+import org.apache.hadoop.ozone.client.MockOmTransport;
+import org.apache.hadoop.ozone.client.MockXceiverClientFactory;
 import org.apache.hadoop.ozone.OzoneManagerVersion;
 import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
+import org.apache.hadoop.ozone.om.helpers.ServiceInfoEx;
+import org.apache.hadoop.ozone.om.protocolPB.OmTransport;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.apache.ozone.test.GenericTestUtils.LogCapturer;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.EnumSource;

Review Comment:
   Imports needed for logger suggestion:
   
   ```suggestion
   import org.junit.jupiter.params.provider.EnumSource;
   import org.slf4j.event.Level;
   ```



##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -215,4 +227,41 @@ public void testFutureVersionShouldNotBeAnExpectedVersion() {
         IllegalArgumentException.class,
         () -> validateOmVersion(OzoneManagerVersion.FUTURE_VERSION, null));
   }
+
+  @Test
+  public void testCloseTwiceDoesNotWarn() throws IOException {
+    RpcClient rpcClient = createRpcClient();
+    LogCapturer logs = LogCapturer.captureLogs(Logger.getRootLogger(),
+        new PatternLayout("%p %c %m%n"));

Review Comment:
   - `IOUtils.cleanupWithLogger` logs exceptions at `DEBUG`, so we need to set at least that level if we want to make sure it does not encounter any.  Otherwise the assertion about log content may succeed even without the fix.
   - `PatternLayout` and `getRootLogger` are unnecessary.
   
   ```suggestion
       GenericTestUtils.setLogLevel(RpcClient.class, Level.DEBUG);
       LogCapturer logs = LogCapturer.captureLogs(RpcClient.class);
   ```



##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -18,14 +18,26 @@
 package org.apache.hadoop.ozone.client.rpc;
 
 import static org.apache.hadoop.ozone.client.rpc.RpcClient.validateOmVersion;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
+import org.apache.hadoop.ozone.client.MockOmTransport;
+import org.apache.hadoop.ozone.client.MockXceiverClientFactory;
 import org.apache.hadoop.ozone.OzoneManagerVersion;
 import org.apache.hadoop.ozone.om.helpers.ServiceInfo;
+import org.apache.hadoop.ozone.om.helpers.ServiceInfoEx;
+import org.apache.hadoop.ozone.om.protocolPB.OmTransport;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;

Review Comment:
   Imports needed for logger suggestion:
   
   ```suggestion
   import org.apache.ozone.test.GenericTestUtils;
   ```



##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -18,14 +18,26 @@
 package org.apache.hadoop.ozone.client.rpc;
 
 import static org.apache.hadoop.ozone.client.rpc.RpcClient.validateOmVersion;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;

Review Comment:
   Imports for `assertThat` suggestion:
   
   ```suggestion
   import static org.assertj.core.api.Assertions.assertThat;
   import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
   import static org.junit.jupiter.api.Assertions.assertEquals;
   ```



##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -215,4 +227,41 @@ public void testFutureVersionShouldNotBeAnExpectedVersion() {
         IllegalArgumentException.class,
         () -> validateOmVersion(OzoneManagerVersion.FUTURE_VERSION, null));
   }
+
+  @Test
+  public void testCloseTwiceDoesNotWarn() throws IOException {
+    RpcClient rpcClient = createRpcClient();
+    LogCapturer logs = LogCapturer.captureLogs(Logger.getRootLogger(),
+        new PatternLayout("%p %c %m%n"));
+    logs.clearOutput();
+
+    try {
+      assertDoesNotThrow(() -> {
+        rpcClient.close();
+        rpcClient.close();
+      });
+
+      String output = logs.getOutput();
+      assertFalse(output.contains("WARN"), output);
+      assertFalse(output.contains("This metrics class is not used."), output);

Review Comment:
   Please use `assertThat` instead of `assertTrue`/`assertFalse` for types where it provides assertions with more useful failure messages.
   
   ```suggestion
         assertThat(logs.getOutput())
             .doesNotContain("WARN")
             .doesNotContain("This metrics class is not used.");
   ```
   
   Compare:
   
   ```
   expected: <false> but was: <true>
   ```
   
   to
   
   ```
   Expecting actual:
     "... [ForkJoinPool-1-worker-1] DEBUG rpc.RpcClient (IOUtils.java:cleanupWithLogger(61)) - Exception in closing org.apache.hadoop.hdds.scm.ContainerClientMetrics$Handle@4fd1e151
   java.lang.IllegalStateException: This metrics class is not used.
   ...
   "
   not to contain:
     "This metrics class is not used."
   ```



-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3405392161


##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -18,14 +18,26 @@
 package org.apache.hadoop.ozone.client.rpc;
 
 import static org.apache.hadoop.ozone.client.rpc.RpcClient.validateOmVersion;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 
+import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
+import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.scm.XceiverClientFactory;
+import org.apache.hadoop.ozone.client.MockOmTransport;
+import org.apache.hadoop.ozone.client.MockXceiverClientFactory;
 import org.apache.hadoop.ozone.OzoneManagerVersion;

Review Comment:
   Fix checkstyle:
   
   ```suggestion
   import org.apache.hadoop.ozone.OzoneManagerVersion;
   import org.apache.hadoop.ozone.client.MockOmTransport;
   import org.apache.hadoop.ozone.client.MockXceiverClientFactory;
   ```



-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #10478:
URL: https://github.com/apache/ozone/pull/10478#issuecomment-4699559450

   Thanks @Pigueiras for the patch, @amaliujia, @jojochuang, @peterxcli, @yandrey321 for the review.


-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3394234038


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########


Review Comment:
   what if we add a metrics handle for `ContainerClientMetrics`?
   ```java
   /**
    * Handle for ContainerClientMetrics.
    */
   public static final class Handle implements AutoCloseable {
     private final ContainerClientMetrics metrics;
     private final AtomicBoolean closed = new AtomicBoolean(false);
   
     private Handle(ContainerClientMetrics metrics) {
       this.metrics = metrics;
     }
   
     public ContainerClientMetrics metrics() {
       return metrics;
     }
   
     @Override
     public void close() {
       if (closed.compareAndSet(false, true)) {
         release();
       }
     }
   }
   
   public static Handle acquireHandle() {
     return new Handle(acquire());
   }
   ```
   
   so inside the `RpcClient`:
   ```java
   public RpcClient(ConfigurationSource conf, String omServiceId) throws IOException {
     // ...
     this.clientMetricsHandle = ContainerClientMetrics.acquireHandle();
     this.clientMetrics = clientMetricsHandle.metrics();
     // ...
   }
   
   @Override
   public void close() throws IOException {
     // ...
   
     // ContainerClientMetrics.release();
     clientMetricsHandle.close();
   }
   ```



-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #10478:
URL: https://github.com/apache/ozone/pull/10478#discussion_r3400865385


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1948,6 +1950,9 @@ private OmKeyInfo getKeyInfo(OmKeyArgs keyArgs) throws IOException {
 
   @Override
   public void close() throws IOException {
+    if (!closed.compareAndSet(false, true)) {
+      return;
+    }

Review Comment:
   +1



-- 
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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #10478:
URL: https://github.com/apache/ozone/pull/10478#issuecomment-4692282341

   > I pushed an updated proposal here: [Pigueiras@488956c](https://github.com/Pigueiras/ozone/commit/488956cb522855ffdb773672324b19ed77902a47), not sure if it addresses everything you suggested.
   
   @amaliujia @peterxcli please take a look at https://github.com/Pigueiras/ozone/commit/488956cb522855ffdb773672324b19ed77902a47, and let @Pigueiras know if it addresses all your suggestions, then the PR can be updated to 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@ozone.apache.org

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


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


Re: [PR] HDDS-15522. Make RpcClient close idempotent [ozone]

Posted by "peterxcli (via GitHub)" <gi...@apache.org>.
peterxcli commented on PR #10478:
URL: https://github.com/apache/ozone/pull/10478#issuecomment-4692310477

   thanks @amaliujia for the update, the handle part LGTM, how about we add a regression test to close the rpcClient twice and check there is no warning pop out.


-- 
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@ozone.apache.org

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


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