You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/10/13 18:31:59 UTC

[GitHub] [hadoop-ozone] bharatviswa504 opened a new pull request #1493: HDDS-4327. Potential resource leakage using BatchOperation.

bharatviswa504 opened a new pull request #1493:
URL: https://github.com/apache/hadoop-ozone/pull/1493


   ## What changes were proposed in this pull request?
   
   Potential resource leakage using BatchOperation.
   
   Use try enclosed resource/close the batch once after it usage is completed.
   
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-4327
   
   ## How was this patch tested?
   
   Existing tests.
   


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

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



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


[GitHub] [hadoop-ozone] hanishakoneru commented on pull request #1493: HDDS-4327. Potential resource leakage using BatchOperation.

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on pull request #1493:
URL: https://github.com/apache/hadoop-ozone/pull/1493#issuecomment-708718652


   Thanks @bharatviswa504. +1 for merge.


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

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



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


[GitHub] [hadoop-ozone] bharatviswa504 commented on a change in pull request #1493: HDDS-4327. Potential resource leakage using BatchOperation.

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #1493:
URL: https://github.com/apache/hadoop-ozone/pull/1493#discussion_r504974154



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
##########
@@ -397,33 +399,29 @@ public void updateDeleteTransactionId(Map<Long, Long> deleteTransactionMap)
     if (deleteTransactionMap == null) {
       return;
     }
-    org.apache.hadoop.hdds.utils.db.BatchOperation batchOperation =
-        batchHandler.initBatchOperation();
-    lock.lock();
-    try {
-      for (Map.Entry<Long, Long> entry : deleteTransactionMap.entrySet()) {
+    try(org.apache.hadoop.hdds.utils.db.BatchOperation batchOperation =
+        batchHandler.initBatchOperation()) {
+      lock.lock();

Review comment:
       Good catch. Fixed in the latest commit.




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

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



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


[GitHub] [hadoop-ozone] hanishakoneru commented on a change in pull request #1493: HDDS-4327. Potential resource leakage using BatchOperation.

Posted by GitBox <gi...@apache.org>.
hanishakoneru commented on a change in pull request #1493:
URL: https://github.com/apache/hadoop-ozone/pull/1493#discussion_r504812062



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
##########
@@ -397,33 +399,29 @@ public void updateDeleteTransactionId(Map<Long, Long> deleteTransactionMap)
     if (deleteTransactionMap == null) {
       return;
     }
-    org.apache.hadoop.hdds.utils.db.BatchOperation batchOperation =
-        batchHandler.initBatchOperation();
-    lock.lock();
-    try {
-      for (Map.Entry<Long, Long> entry : deleteTransactionMap.entrySet()) {
+    try(org.apache.hadoop.hdds.utils.db.BatchOperation batchOperation =
+        batchHandler.initBatchOperation()) {
+      lock.lock();

Review comment:
       Shouldn't lock() be called outside the try block? If there is a chance that the initBatchOperation() can fail, then lock.unlock() would throw IllegalMonitorStateException as the lock is not held by 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.

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



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


[GitHub] [hadoop-ozone] hanishakoneru merged pull request #1493: HDDS-4327. Potential resource leakage using BatchOperation.

Posted by GitBox <gi...@apache.org>.
hanishakoneru merged pull request #1493:
URL: https://github.com/apache/hadoop-ozone/pull/1493


   


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

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



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