[
https://issues.apache.org/jira/browse/OAK-5915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15902819#comment-15902819
]
Thomas Mueller commented on OAK-5915:
-------------------------------------
I don't know yet what the problem could be. As far as I see, those fields are
synchronized correctly. The relavant code is:
{noformat}
private synchronized void access(Object key, int hash) {
Entry<K, V> e = find(key, hash);
if (e == null || e.value == null) {
return;
}
if (e.isHot()) {
if (e != stack.stackNext) {
if (stackMoveDistance == 0 || stackMoveCounter - e.topMove
> stackMoveDistance) {
// move a hot entry to the top of the stack
// unless it is already there
boolean wasEnd = e == stack.stackPrev;
removeFromStack(e); <<== here
private void removeFromStack(Entry<K, V> e) {
e.stackPrev.stackNext = e.stackNext; <<== here
e.stackNext.stackPrev = e.stackPrev;
e.stackPrev = e.stackNext = null;
stackSize--;
}
{noformat}
So the NPE occurs here: {{e.stackPrev.stackNext = e.stackNext;}}. As {{e}} can
not be null
because {{access}} checks that. So {{e.stackPrev}} is null. The field
{{stack.stackNext}} and {{e.stackPrev}} are used here:
* synchronized access
* addToStack (synchronized access, synchronized put)
* addToStackBottom (synchronized invalidate)
* synchronized clear
* convertOldestHotToCold (synchronized access, evict)
* pruneStack (synchronized access, convertOldestHotToCold, synchronized
invalidate)
* removeFromStack (synchronized access, convertOldestHotToCold, synchronized
invalidate, pruneStack)
* evict (synchronized put)
They are changed here:
* addToStack
* addToStackBottom
* removeFromStack
* synchronized clear
New Entry objects are created here:
* synchronized clear
* synchronized put
> NPE in LIRS cache
> -----------------
>
> Key: OAK-5915
> URL: https://issues.apache.org/jira/browse/OAK-5915
> Project: Jackrabbit Oak
> Issue Type: Bug
> Components: cache, core
> Affects Versions: 1.8
> Reporter: Michael Dürig
> Assignee: Thomas Mueller
> Fix For: 1.8
>
>
> While experimenting with a snapshot of a production repository I hit an
> {{NPE}} in the LIRS cache:
> {noformat}
> java.lang.NullPointerException
>
> org.apache.jackrabbit.oak.cache.CacheLIRS$Segment.removeFromStack(CacheLIRS.java:1333)
> org.apache.jackrabbit.oak.cache.CacheLIRS$Segment.access(CacheLIRS.java:907)
> org.apache.jackrabbit.oak.cache.CacheLIRS$Segment.get(CacheLIRS.java:880)
> org.apache.jackrabbit.oak.cache.CacheLIRS.getIfPresent(CacheLIRS.java:372)
> org.apache.jackrabbit.oak.segment.ReaderCache.get(ReaderCache.java:116)
>
> org.apache.jackrabbit.oak.segment.CachingSegmentReader.readString(CachingSegmentReader.java:90)
> org.apache.jackrabbit.oak.segment.Segment.readTemplate(Segment.java:567)
>
> org.apache.jackrabbit.oak.segment.CachingSegmentReader$2.apply(CachingSegmentReader.java:118)
>
> org.apache.jackrabbit.oak.segment.CachingSegmentReader$2.apply(CachingSegmentReader.java:114)
> org.apache.jackrabbit.oak.segment.ReaderCache.get(ReaderCache.java:118)
>
> org.apache.jackrabbit.oak.segment.CachingSegmentReader.readTemplate(CachingSegmentReader.java:114)
>
> org.apache.jackrabbit.oak.segment.SegmentNodeState.getTemplate(SegmentNodeState.java:102)
>
> org.apache.jackrabbit.oak.segment.SegmentNodeState.getChildNodeEntries(SegmentNodeState.java:439)
> {noformat}
> Unfortunately no further information or ways to reproduce this.
> FYI [~tmueller]
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)