Thanks for your responses.
Stefan, We open the repository first, then enter a state to service requests. For each request we open a session, process the request and close the session. Clay, The implementors of the request processing code were instructed to use the try-finally pattern for opening and closing a session. We will check whether this instruction was followed faithfully in every case. We are familiar with the meta64 code; in fact, our code for opening and closing the repository was closely based on yours. The only essential difference is that we do not have an explicit Oak executor. Your code does not seem to do anything with this executor other than shut it down. Is its sole purpose to be able to do this as part of the whole shutdown? In any case, we will try adding an explicit executor to see if that solves the problem. Mike ________________________________ From: Clay Ferguson <[email protected]> Sent: Thursday, July 6, 2017 7:14:22 AM To: [email protected] Subject: Re: Oak repository using MongoDB fails to renew lease Sefan, 1) make sure you are using a try/finally block to be sure to always close each session after using it 2) look at the following code to see if you are closing everything in the way this code does: Specifically, look at the close() method: https://github.com/Clay-Ferguson/meta64/blob/master/src/main/java/com/meta64/mobile/repo/OakRepository.java It should solve your problem, because I have seen that before until i started closing everything properly every time. Best regards, Clay Ferguson [email protected] On Thu, Jul 6, 2017 at 3:13 AM, Stefan Egli <[email protected]> wrote: > Hi Michael, > > This sounds like the session you're using might be referring to the closed > repository. Did you create a new session after closing + opening the > repository? > > Cheers, > Stefan > > On 06/07/17 07:40, "Michael Harrison" <[email protected]> > wrote: > > >Hi all, > > > > > >We are new to Oak. We are using an Oak repository that is supported by a > >MongoDB back end. The Mongo server is running continuously. We restart > >the Oak repository from time to time. The startup code is this, stripped > >to the essentials: > > > > > > db = new MongoClient(mongoUrl, mongoPort).getDB(mongoDbName); > > ns = new DocumentMK.Builder().setMongoDB(db).getNodeStore(); > > Jcr jcr = new Jcr(new Oak(ns)); > > repository = jcr.createRepository(); > > > > > >When we close the Oak repository we do this: > > > > ns.dispose(); // private DocumentNodeStore ns > > ((RepositoryImpl)repository).shutdown(); > > db.getMongo().close(); // private com.mongo.DB db > > > > > >The observation is that when we do the following sequence of actions: > > > > > > 1. Close the repository > > 2. Wait for a few minutes > > 3. Open the repository > > > > > >and then try to access the contents of the repository using > >Session.getNodeById we get the following exception: > > > > > >org.apache.jackrabbit.oak.plugins.document.DocumentStoreException: This > >oak instance failed to update the lease in time and can therefore no > >longer access this DocumentNodeStore. > > at > >org.apache.jackrabbit.oak.plugins.document.ClusterNodeInfo.leaseExpired( > Cl > >usterNodeInfo.java:1154) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.ClusterNodeInfo. > performLeaseChe > >ck(ClusterNodeInfo.java:662) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.util. > LeaseCheckDocumentStoreWra > >pper.performLeaseCheck(LeaseCheckDocumentStoreWrapper.java:59) > >~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.util. > LeaseCheckDocumentStoreWra > >pper.find(LeaseCheckDocumentStoreWrapper.java:65) > >~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.readNode( > Docu > >mentNodeStore.java:1214) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore$5.call( > Docume > >ntNodeStore.java:1011) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore$5.call( > Docume > >ntNodeStore.java:1004) ~[oak-core-1.6.1.jar:1.6.1] > > at > >com.google.common.cache.LocalCache$LocalManualCache$1. > load(LocalCache.java > >:4739) ~[guava-16.0.jar:?] > > at > >com.google.common.cache.LocalCache$LoadingValueReference. > loadFuture(LocalC > >ache.java:3524) ~[guava-16.0.jar:?] > > at > >com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) > >~[guava-16.0.jar:?] > > at > >com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache. > java > >:2280) ~[guava-16.0.jar:?] > > at > >com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) > >~[guava-16.0.jar:?] > > at com.google.common.cache.LocalCache.get(LocalCache.java:3934) > >~[guava-16.0.jar:?] > > at > >com.google.common.cache.LocalCache$LocalManualCache. > get(LocalCache.java:47 > >36) ~[guava-16.0.jar:?] > > at > >org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.getNode( > Docum > >entNodeStore.java:1004) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.DocumentNodeState. > getChildNodeD > >oc(DocumentNodeState.java:485) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.document.DocumentNodeState. > getChildNode( > >DocumentNodeState.java:250) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.index.property. > strategy.UniqueEntryStore > >Strategy.count(UniqueEntryStoreStrategy.java:190) > >~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.index.property. > strategy.UniqueEntryStore > >Strategy.count(UniqueEntryStoreStrategy.java:204) > >~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.index.property. > PropertyIndexPlan.<init>( > >PropertyIndexPlan.java:148) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.index.property. > PropertyIndex.createPlan( > >PropertyIndex.java:162) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.index.property. > PropertyIndex.getPlan(Pro > >pertyIndex.java:145) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.index.property. > PropertyIndex.getCost(Pro > >pertyIndex.java:208) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.QueryImpl.getBestSelectorExecutionPlan( > Que > >ryImpl.java:1035) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.QueryImpl.getBestSelectorExecutionPlan( > Que > >ryImpl.java:976) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.ast.SelectorImpl. > prepare(SelectorImpl.java > >:280) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.QueryImpl.prepare(QueryImpl.java:641) > >~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.QueryEngineImpl. > prepareAndSelect(QueryEngi > >neImpl.java:294) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.QueryEngineImpl. > executeQuery(QueryEngineIm > >pl.java:269) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.query.QueryEngineImpl. > executeQuery(QueryEngineIm > >pl.java:229) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.identifier. > IdentifierManager.resolveUUID > >(IdentifierManager.java:352) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.identifier. > IdentifierManager.resolveUUID > >(IdentifierManager.java:346) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.identifier. > IdentifierManager.resolveUUID > >(IdentifierManager.java:342) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.plugins.identifier. > IdentifierManager.getTree(Ide > >ntifierManager.java:137) ~[oak-core-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate. > getNodeByIdentifier > >(SessionDelegate.java:457) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl$5. > perform(SessionImpl.ja > >va:322) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl$5. > perform(SessionImpl.ja > >va:318) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate. > perform(SessionDele > >gate.java:208) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl. > getNodeById(SessionImpl. > >java:318) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl$5. > perform(SessionImpl.ja > >va:322) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl$5. > perform(SessionImpl.ja > >va:318) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate. > perform(SessionDele > >gate.java:208) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl. > getNodeById(SessionImpl. > >java:318) ~[oak-jcr-1.6.1.jar:1.6.1] > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl. > getNodeByIdentifier(Sess > >ionImpl.java:340) ~[oak-jcr-1.6.1.jar:1.6.1] > > > > > >How can we avoid this exception happening? > > > >Mike Harrison > >DISCLAIMER > >========== > >This e-mail may contain privileged and confidential information which is > >the property of Persistent Systems Ltd. It is intended only for the use > >of the individual or entity to which it is addressed. If you are not the > >intended recipient, you are not authorized to read, retain, copy, print, > >distribute or use this message. If you have received this communication > >in error, please notify the sender and delete all copies of this message. > >Persistent Systems Ltd. does not accept any liability for virus infected > >mails. > > > DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.
