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

Iterator leak in HasContainer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.4.8
    • 3.5.0, 3.4.9
    • process
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: