jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Mueller (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OAK-3234) LIRS cache: possible deadlock while loading an entry
Date Fri, 14 Aug 2015 13:56:45 GMT
Thomas Mueller created OAK-3234:
-----------------------------------

             Summary: LIRS cache: possible deadlock while loading an entry
                 Key: OAK-3234
                 URL: https://issues.apache.org/jira/browse/OAK-3234
             Project: Jackrabbit Oak
          Issue Type: Bug
            Reporter: Thomas Mueller
            Assignee: Thomas Mueller
             Fix For: 1.3.4


If multiple threads concurrently load entries while they are already loading entries (using
a cache loader or callable), then it is possible to get into a deadlock. For example:

* Thread 1 loads entry A, so it is calling the loader...
* Thread 2 loads entry B, so it is calling the loader...
* Thread 1 (within the loader) tries to load entry B, so it waits for thread 2...
* Thread 2 (within the loader) tries to load entry A, so it waits for thread 1...

One solution is to detect the case that the current thread is already loading an entry, and
then instead of waiting for the other thread, it can also load the entry. A small optimization
for that is to only load the entry (not waiting for the other thread) if the hash code of
the key is smaller or equal the entry that this thread is loading. So that there is a clear
order.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message