Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-11101

Purge on JDBC shared stores can cause deadlocks

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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:

      1. purge locks all the rows
      2. purge sends a RemoveExpiredCommand and waits for it to complete
      3. 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.

              remerson@redhat.com Ryan Emerson
              remerson@redhat.com Ryan Emerson
              Archiver:
              rhn-support-adongare Amol Dongare

                Created:
                Updated:
                Resolved:
                Archived: