Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2408

Iterator leak in HasContainer

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.8
    • Fix Version/s: 3.5.0, 3.4.9
    • Component/s: process
    • Labels:
      None

      Description

      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:

              try {
                  while (itty.hasNext()) {
                      if (testValue(itty.next()))
                          return true;
                  }
              } finally {
                  if (itty instanceof AutoCloseable) {
                      ((AutoCloseable) itty).close();
                  }
              }
      

        Attachments

          Activity

            People

            • Assignee:
              divijvaidya Divij Vaidya
              Reporter:
              divijvaidya Divij Vaidya
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: