]
Dan Berindei updated ISPN-11101:
--------------------------------
Git Pull Request:
Purge on JDBC shared stores can cause deadlocks
-----------------------------------------------
Key: ISPN-11101
URL:
https://issues.redhat.com/browse/ISPN-11101
Project: Infinispan
Issue Type: Bug
Components: Loaders and Stores
Affects Versions: 9.4.17.Final, 10.1.0.CR1
Reporter: Ryan Emerson
Assignee: Ryan Emerson
Priority: Major
Fix For: 10.1.0.Final, 9.4.18.Final
ISPN-10337 ensured that the JdbcStringBasedStore correctly acquired the locks of expired
rows during the purging of store entries, however it has exposed an issue with shared
stores. When the jdbc store is shared, the coordinator locks the rows of the affected
entries and releases them once they have all been removed as part of the purge
transaction. However, the call to {{ExpirationManager::handleInStoreExpiration}} also
sends a {{RemoveExpiredCommand}} to ensure that entries are removed from memory. This
results in a {{java.sql.SQLException: Lock wait timeout exceeded; try restarting
transaction}} being thrown by the store's delete method when the purge process is
still in progress, because the expired rows are still locked and the purge process cannot
complete until the {{RemoveExpiredCommand}} has been executed.
In summary:
# purge locks all the rows
# purge sends a RemoveExpiredCommand and waits for it to complete
# RemoveExpiredCommand tries to remove the row but it can't as it is locked
Solution, send the {{RemoveExpiredCommand}} with the {{SKIP_CACHE_STORE}} flag when a
store is shared,so that it only removes entries from memory.