This is from #3753 (comment)
There is a race condition in QueryIterPlainWrapper and QueryIterAbortable which inherits from QueryIterPlainWrapper.
requestClose and close both call closeIterator but from different threads. closeIterator clears the iterator member.
Using synchronized on closeIterator and close should fix observed test failures (#3751).
However, these operations may cause internal state on the wrapped iterator.
hasNextBinding / moveToNextBinding / close (normal operation) will running on the query executiuon thread, so no concurrency issues,
But requestClose is called on a separate thread and it too may manipulate the internal state on the wrapped iterator.