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

Purge on JDBC shared stores can cause deadlocks

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              remerson@redhat.com Ryan Emerson
              remerson@redhat.com Ryan Emerson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: