jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julian Reschke (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (OAK-8051) PersistentCache: error during open can lead to incomplete initialization and subsequent NPEs
Date Wed, 27 Feb 2019 12:07:00 GMT

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

Julian Reschke edited comment on OAK-8051 at 2/27/19 12:06 PM:
---------------------------------------------------------------

bq. What's wrong with the current code is that:
bq. 
bq.     A NPE is logged in CacheMap, which can be confusing
bq.     It would be better if 10 retries are attempted immediately in the constructor of CacheMap,
instead of later on when trying to use the CacheMap

Actually what's wrong is that if the first attempt to open the map fails, the object fill
have a null map and will not be in status closed, thus causing an NPE when calling {{get()}}.
Changing the constructor to enforce {{map}} not be {{null}} or {{closed}} to be {{true}} indeed
should fix this.


was (Author: reschke):
bq. What's wrong with the current code is that:
bq. 
bq.     A NPE is logged in CacheMap, which can be confusing
bq.     It would be better if 10 retries are attempted immediately in the constructor of CacheMap,
instead of later on when trying to use the CacheMap

Actually what's wrong is that if the first attempt to open the map fails, the object fill
have a null map and will not be in status closed, thus causing an NPE when calling {{get()}}.
Changing the constructor to enforce {{map}} not be {null}} or {{closed}} to be {{true}} indeed
should fix this.

> PersistentCache: error during open can lead to incomplete initialization and subsequent
NPEs
> --------------------------------------------------------------------------------------------
>
>                 Key: OAK-8051
>                 URL: https://issues.apache.org/jira/browse/OAK-8051
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: documentmk
>    Affects Versions: 1.6.6
>            Reporter: Julian Reschke
>            Priority: Major
>              Labels: candidate_oak_1_10, candidate_oak_1_6, candidate_oak_1_8, patch-available
>             Fix For: 1.12
>
>         Attachments: OAK-8051.diff
>
>
> Seen in the wild (in 1.6.6):
> {noformat}
> 22.01.2019 08:45:13.153 *WARN* [http-/0.0.0.0:80-3] org.apache.jackrabbit.oak.plugins.document.persistentCache.MapFactory
Could not open the store _path_/cache-4.data
> java.lang.IllegalStateException: The file is locked: nio:_path_/cache-4.data [1.4.193/7]
> 	at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:765)
> 	at org.h2.mvstore.FileStore.open(FileStore.java:168)
> 	at org.h2.mvstore.MVStore.<init>(MVStore.java:348)
> 	at org.h2.mvstore.MVStore$Builder.open(MVStore.java:2923)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache$1.openStore(PersistentCache.java:288)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache.createMapFactory(PersistentCache.java:361)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache.<init>(PersistentCache.java:210)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.getPersistentCache(DocumentMK.java:1232)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.buildCache(DocumentMK.java:1211)
> {noformat}
> Later on:
> {noformat}
> 22.01.2019 08:45:13.155 *WARN* [http-/0.0.0.0:80-3] org.apache.jackrabbit.oak.plugins.document.persistentCache.MapFactory
Could not open the map
> java.lang.NullPointerException: null
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache$1.openMap(PersistentCache.java:335)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheMap.openMap(CacheMap.java:135)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheMap.<init>(CacheMap.java:48)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache.openMap(PersistentCache.java:468)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.NodeCache.addGeneration(NodeCache.java:115)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache.initGenerationCache(PersistentCache.java:452)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.PersistentCache.wrap(PersistentCache.java:443)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.buildCache(DocumentMK.java:1214)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.buildPrevDocumentsCache(DocumentMK.java:1182)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.buildNodeDocumentCache(DocumentMK.java:1189)
> 	at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.initialize(RDBDocumentStore.java:798)
> 	at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.<init>(RDBDocumentStore.java:212)
> 	at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.<init>(RDBDocumentStore.java:224)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.setRDBConnection(DocumentMK.java:757)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStore(DocumentNodeStoreService.java:508)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStoreIfPossible(DocumentNodeStoreService.java:430)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.activate(DocumentNodeStoreService.java:414)
> {noformat}
> and then
> {noformat}
> 22.01.2019 08:45:16.808 *WARN* [http-/0.0.0.0:80-3] org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheMap
Re-opening map PREV_DOCUMENT
> java.lang.NullPointerException: null
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.CacheMap.get(CacheMap.java:87)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.MultiGenerationMap.readValue(MultiGenerationMap.java:71)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.NodeCache.asyncReadIfPresent(NodeCache.java:147)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.NodeCache.readIfPresent(NodeCache.java:130)
> 	at org.apache.jackrabbit.oak.plugins.document.persistentCache.NodeCache.getIfPresent(NodeCache.java:213)
> 	at org.apache.jackrabbit.oak.plugins.document.cache.NodeDocumentCache.getIfPresent(NodeDocumentCache.java:155)
> 	at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.readDocumentCached(RDBDocumentStore.java:1130)
> 	at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.find(RDBDocumentStore.java:234)
> 	at org.apache.jackrabbit.oak.plugins.document.rdb.RDBDocumentStore.find(RDBDocumentStore.java:229)
> 	at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getPreviousDocument(NodeDocument.java:1338)
> 	at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getPreviousDocs(NodeDocument.java:1307)
> 	at org.apache.jackrabbit.oak.plugins.document.ValueMap$2.containsKey(ValueMap.java:170)
> 	at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getPreviousDocs(NodeDocument.java:1309)
> 	at org.apache.jackrabbit.oak.plugins.document.ValueMap$2.containsKey(ValueMap.java:170)
> 	at org.apache.jackrabbit.oak.plugins.document.NodeDocument.getPreviousDocs(NodeDocument.java:1309)
> 	at org.apache.jackrabbit.oak.plugins.document.NodeDocument.isCommitted(NodeDocument.java:547)
> 	at org.apache.jackrabbit.oak.plugins.document.LastRevRecoveryAgent.determineLastModification(LastRevRecoveryAgent.java:402)
> 	at org.apache.jackrabbit.oak.plugins.document.LastRevRecoveryAgent.recover(LastRevRecoveryAgent.java:191)
> 	at org.apache.jackrabbit.oak.plugins.document.LastRevRecoveryAgent.recover(LastRevRecoveryAgent.java:156)
> 	at org.apache.jackrabbit.oak.plugins.document.LastRevRecoveryAgent.recoverCandidates(LastRevRecoveryAgent.java:369)
> 	at org.apache.jackrabbit.oak.plugins.document.LastRevRecoveryAgent.recover(LastRevRecoveryAgent.java:128)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.checkLastRevRecovery(DocumentNodeStore.java:646)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.<init>(DocumentNodeStore.java:564)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentMK$Builder.getNodeStore(DocumentMK.java:856)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStore(DocumentNodeStoreService.java:551)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.registerNodeStoreIfPossible(DocumentNodeStoreService.java:430)
> 	at org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.activate(DocumentNodeStoreService.java:414)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message