[ 
https://issues.apache.org/jira/browse/OAK-3234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15163031#comment-15163031
 ] 

Tomek Rękawek edited comment on OAK-3234 at 2/24/16 2:05 PM:
-------------------------------------------------------------

Attached patch backported for 1.0 and 1.2. [~tmueller], could you apply it? 
There are Oak 1.0 customers suffering from this deadlock.


was (Author: tomek.rekawek):
Attached patch backported for 1.0 and 1.2.

> 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
>          Components: core
>            Reporter: Thomas Mueller
>            Assignee: Thomas Mueller
>             Fix For: 1.3.4
>
>         Attachments: OAK-3234-backported.patch
>
>
> 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)

Reply via email to