[ https://issues.apache.org/jira/browse/JENA-2151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17402604#comment-17402604 ]
Andy Seaborne commented on JENA-2151: ------------------------------------- > I also don't see downsides of having Iter.filter implement Closeable. Do you? As stated before - it only partially works, if at all, and is not in other Iter operations, such as that IteratorFlatMap. We don't want half-a-fix - that's future trouble. If an iterator runs to completion, the underlying iterator close happens automatically so this is being closed before the end? That's consistent with the modifed IteratorFilter as it does not pass down close() on normal completion. So if the change makes a difference, it's on an aborted iterator. Correct? > unclosed iterator warnings The code in StageMatchTriple.accessTriple is not making a QueryIterator call - it's a graph call so it's an ExtendedIterator and so the unclosed iterator warnings are not from the query iterator tracker code (unless the graph is calling back into ARQ). Are the warnings from TQ tracking code? May be SolveRX3 should be: {noformat} ExtendedIterator<Binding> iter = graphIter.mapWith( r -> mapper(resultsBuilder, s, p, o, r)); return iter.filterKeep(Objects::nonNull); {noformat} > Iter.filter does not close nested iterator > ------------------------------------------ > > Key: JENA-2151 > URL: https://issues.apache.org/jira/browse/JENA-2151 > Project: Apache Jena > Issue Type: Bug > Affects Versions: Jena 4.1.0 > Reporter: Holger Knublauch > Priority: Major > Attachments: IteratorFilter.java > > > We recently attempted to upgrade our product to Jena 4.1.0 but noticed > unclosed iterator warnings. I believe I have tracked it down to the fact that > Iter.filter does not return a Closeable iterator and therefore does not close > its nested (stream) iterator. I am attaching an implementation class that > seems to fix it. With this, org.apache.jena.atlas.iterator.Iter.filter simply > need to become > {code:java} > public static <T> Iterator<T> filter(final Iterator<? extends T> stream, > final Predicate<T> filter) { > return new IteratorFilter<T>(stream, filter); > } > {code} > (Although Iter.filter hasn't changed for a while, I suspect some other > changes to Jena caused the SPARQL engine to use it, and this has broken some > scenarios for us - in particular calling SPIN/SHACL-SPARQL functions with > BGPs in the WHERE clause). -- This message was sent by Atlassian Jira (v8.3.4#803005)