echonesis commented on code in PR #11841:
URL: https://github.com/apache/ozone/pull/11841#discussion_r4438404656


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/SnapshotDiffManager.java:
##########
@@ -1182,12 +1189,18 @@ void generateSnapshotDiffReport(final String jobKey,
       //  throw this exception.
       throw new RuntimeException(exception);
     } finally {
-      // Decrement ref counts
-      if (rcFromSnapshot != null) {
-        rcFromSnapshot.close();
-      }
-      if (rcToSnapshot != null) {
-        rcToSnapshot.close();
+      try {
+        // Decrement ref counts
+        if (rcFromSnapshot != null) {
+          rcFromSnapshot.close();
+        }
+        if (rcToSnapshot != null) {
+          rcToSnapshot.close();
+        }

Review Comment:
   Thanks for catching this. Updated to `IOUtils.close(LOG, rcFromSnapshot, 
rcToSnapshot)` and kept the outer finally to release the snapshot locks. Added 
a regression test to verify that the second handle is still closed when the 
first throws.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to