You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Tsz-wo Sze (Jira)" <ji...@apache.org> on 2025/06/18 19:27:00 UTC

[jira] [Created] (HDDS-13293) In KeyManagerImpl.listStatus(..), iterator may leak

Tsz-wo Sze created HDDS-13293:
---------------------------------

             Summary: In KeyManagerImpl.listStatus(..), iterator may leak
                 Key: HDDS-13293
                 URL: https://issues.apache.org/jira/browse/HDDS-13293
             Project: Apache Ozone
          Issue Type: Improvement
          Components: OM
            Reporter: Tsz-wo Sze
            Assignee: Tsz-wo Sze


{code}
    TableIterator<String, ? extends KeyValue<String, OmKeyInfo>> iterator;
    Table<String, OmKeyInfo> keyTable;
    metadataManager.getLock().acquireReadLock(BUCKET_LOCK, volumeName,
        bucketName);
    try {
      keyTable = metadataManager.getKeyTable(
          getBucketLayout(metadataManager, volumeName, bucketName));
      iterator = getIteratorForKeyInTableCache(recursive, startKey,
          volumeName, bucketName, cacheKeyMap, keyArgs, keyTable);
    } finally {
      metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
          bucketName);
    }

    try {
      findKeyInDbWithIterator(recursive, startKey, numEntries, volumeName,
          bucketName, keyName, cacheKeyMap, keyArgs, keyTable, iterator);
    } finally {
      iterator.close();
    }
{code}
In the code above, if the first try-block throws an exception, the iterator.close() in the second finally-block will not be called.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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