rdf4j
rdf4j copied to clipboard
TimeLimitIteration calls close() asynchronously from another thread
Current Behavior
Instead of just setting the isInterrupted
flag, the close()
method is directly called from interrupt()
.
The latter method is executed within an asynchronous thread which leads to race conditions if the iterator expects non-multithreaded usage (which is the usual case).
This seems to affect the LmdbRecordIterator
that causes a A heap has been corrupted
exception at least under Windows.
Expected Behavior
The close()
method should not be called asynchronously from another thread.
Maybe a global ThreadLocal
should be introduced which provides access to isInterrupted
or directly a checkInterrupted()
method that throws an exception. Then its up to the individual iterators to check the interrupted state and stop the execution.
Another solution would be to explicitly support the asynchronous invocation of close()
in LmdbRecordIterator
.
Steps To Reproduce
No response
Version
4.2.2
Are you interested in contributing a solution yourself?
Perhaps?
Anything else?
No response