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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to