You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Divij Vaidya (Jira)" <ji...@apache.org> on 2020/08/26 17:43:00 UTC

[jira] [Closed] (TINKERPOP-2408) Iterator leak in HasContainer

     [ https://issues.apache.org/jira/browse/TINKERPOP-2408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Divij Vaidya closed TINKERPOP-2408.
-----------------------------------
    Fix Version/s: 3.4.9
                   3.5.0
         Assignee: Divij Vaidya
       Resolution: Fixed

> 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
>            Assignee: Divij Vaidya
>            Priority: Minor
>             Fix For: 3.5.0, 3.4.9
>
>
> 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)