We're updating the issue view to help you get more done. 

NoSuchElementException thrown from hasNext

Description

If an iterator hasNext() is called from thread A, then thread B closes the iteration, thread A might throw an NoSuchElementException when next() is called. This is related to issue 714 - ORDER BY in query can block query interruption. Some of OrderIterator's createIteration method is shown below for convenience. The state of iter might change after its hasNext() method is called, but before it's next() method is. This will cause the calling method, DelayedIteration.hasNext(), to propagate the NoSuchElementException. Instead, loops like this should check for both hasNext() results and NoSuchElementException and treat them then same way, in this case, end the loop and return without and exception. protected Iteration<BindingSet, QueryEvaluationException> createIteration() throws QueryEvaluationException { TreeMap<BindingSet, Collection<BindingSet>> map; map = new TreeMap<BindingSet, Collection<BindingSet>>(comparator); int size = 0; try { while (iter.hasNext()) { BindingSet next = iter.next();

Environment

None

Status

Assignee

JeenB

Reporter

James Leigh

Labels

None

Fix versions

Affects versions

2.3.2

Priority

Major