Open ElenaKurilina opened 3 months ago
Thanks @ElenaKurilina
This is due to a deadlock issue that was observed with the MemoryStore caused by the use of a ReentrantLock. It's pretty rare for this issue to crop up, but the solution was to always interrupt any thread that could potentially be holding the lock. I'm not sure why you are only seeing this with the ShaclSail but I'll try to investigate.
It might also be wrong to indiscriminately interrupt the other thread, especially since we use interrupts to signal query timeouts. I'll think this over a bit.
@hmottestad Here is my idea https://github.com/DanchoIvanov/rdf4j/tree/GH-4937-edits-deadlock-prevention-thread-logging I know it does not solve the issue however I think it makes the logs more useful. It moves the logging after the thead sleep, so it only logs if it will try to interrupt the owner thread. It also logs the owner stack trace if there is one to help detecting deadlocks. Removes second call of the deadlock prevention thread in made in the method forceCloseActiveOperations since there is one already started from the close method before that.
A fix for this will be available in 5.0.1. I'll see if I can backport it to 4.3.x.
Current Behavior
When we wrapped our base sail into
ShaclSail
we started getting errors when transactioncommit
REST API requests are being processed:My understanding is that transaction
commit
callsShaclSailConnection
close()
which checks transaction owner: If it's not current thread it will try to close the owner thread. In case of REST API, the owner thread will be the tomcat thread that processed transactionbegin
request.Expected Behavior
ShaclSailConnection
not causing any errors when transactions are used via REST API.Steps To Reproduce
close
which checks transaction owner and if it's not current thread will try to close the owner producing following errors:and
Version
3.7.9
Are you interested in contributing a solution yourself?
Yes
Anything else?
I have not noticed this "stopping owner thread on close" logic in other Sails. What was the reason to add it to
ShaclSailConnection
?