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/25 22:47:00 UTC
[jira] [Created] (TINKERPOP-2408) Iterator leak in HasContainer
Divij Vaidya created TINKERPOP-2408:
---------------------------------------
Summary: 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
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) {
Code.wrapThrow(() -> ((AutoCloseable) itty).close());
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)