[ 
https://issues.apache.org/jira/browse/TINKERPOP-2408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17184775#comment-17184775
 ] 

ASF GitHub Bot commented on TINKERPOP-2408:
-------------------------------------------

divijvaidya opened a new pull request #1315:
URL: https://github.com/apache/tinkerpop/pull/1315


   https://issues.apache.org/jira/browse/TINKERPOP-2408
   
   **Change**
   Close the iterator to release resources. If the iterator is not closed, due 
to short circuit return, it could lead to iterator leaks in the underlying 
storage.
   
   **Deployment**
   Added ChangeLog


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


> Iterator leak in HasContainer
> -----------------------------
>
>                 Key: TINKERPOP-2408
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2408
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.4.8
>            Reporter: Divij Vaidya
>            Priority: Minor
>
> The iterator here should be closed in a finally block: 
> https://github.com/apache/tinkerpop/blob/3.4.8/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/HasContainer.java#L85
>  
> If the iterator is not closed, due to short circuit return, it could lead to 
> open iterator leaks in the underlying storage.
> The code should look like:
> {code:java}
>         try {
>             while (itty.hasNext()) {
>                 if (testValue(itty.next()))
>                     return true;
>             }
>         } finally {
>             if (itty instanceof AutoCloseable) {
>                 ((AutoCloseable) itty).close();
>             }
>         }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to