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

Re: [PR] HDDS-17026. DN reserves space until restart for containers failed to create due to unchecked exception [ozone]

sarvekshayr commented on code in PR #11659:
URL: https://github.com/apache/ozone/pull/11659#discussion_r4335193345


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java:
##########
@@ -511,9 +511,12 @@ ContainerCommandResponseProto handleCreateContainer(
         LOG.debug("Container already exists. container Id {}", containerID);
       }
     } catch (StorageContainerException ex) {
-      newContainerData.releaseCommitSpace();
       return ContainerUtils.logAndReturnError(LOG, ex, request);
     } finally {
+      if (!created) {
+        // Release the space reserved when the volume was chosen, also on unchecked exceptions.
+        newContainerData.releaseCommitSpace();
+      }
       containerIdLock.unlock();
     }

Review Comment:
   Lock leak risk: `releaseCommitSpace()` now runs before `containerIdLock.unlock()` in the same finally. 
   If it ever threw, the unlock would be skipped and later creates of that container ID would block. It is unlikely to throw, but unlocking first, or a nested try/finally, removes the risk. 



-- 
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