jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Parvulescu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-3442) Intermittent IllegalMonitorStateException seen while releaseing IndexNode
Date Thu, 24 Sep 2015 07:39:05 GMT

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

Alex Parvulescu commented on OAK-3442:
--------------------------------------

bq. So only way for such an exception to happen is that in a loop of say 2 paths indexNode
got initialized for Loop 1 and then while acquiring in Loop 2 the indexNode still refers to
old released value and that would cause the exception.
so there's a second error in the logs which is missing from the issue description then :)

bq. The fix should be simply to null the variable once released
Not to nitpick, but another solution could also be to move the variable declaration inside
the for block:
{code}
for (String path : indexPaths) {
  IndexNode indexNode = null;
{code}

> Intermittent IllegalMonitorStateException seen while releaseing IndexNode
> -------------------------------------------------------------------------
>
>                 Key: OAK-3442
>                 URL: https://issues.apache.org/jira/browse/OAK-3442
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>            Priority: Minor
>             Fix For: 1.3.8
>
>
> At times following exception seen. On this system the index got corrupted because backing
index files got deleted from the system and hence index is not accessible. 
> {noformat}
> 21.09.2015 09:26:36.764 *ERROR* [FelixStartLevel] com.adobe.granite.repository.impl.SlingRepositoryManager
start: Uncaught Throwable trying to access Repository, calling stopRepository()
> java.lang.IllegalMonitorStateException: attempt to unlock read lock, not locked by current
thread
>         at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.unmatchedUnlockException(ReentrantReadWriteLock.java:444)
>         at java.util.concurrent.locks.ReentrantReadWriteLock$Sync.tryReleaseShared(ReentrantReadWriteLock.java:428)
>         at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1341)
>         at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.unlock(ReentrantReadWriteLock.java:881)
>         at org.apache.jackrabbit.oak.plugins.index.lucene.IndexNode.release(IndexNode.java:121)
>         at org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndex.getPlans(LucenePropertyIndex.java:212)
>         at org.apache.jackrabbit.oak.query.QueryImpl.getBestSelectorExecutionPlan(QueryImpl.java:847)
>         at org.apache.jackrabbit.oak.query.QueryImpl.getBestSelectorExecutionPlan(QueryImpl.java:793)
>         at org.apache.jackrabbit.oak.query.ast.SelectorImpl.prepare(SelectorImpl.java:283)
>         at org.apache.jackrabbit.oak.query.QueryImpl.prepare(QueryImpl.java:568)
>         at org.apache.jackrabbit.oak.query.QueryEngineImpl.executeQuery(QueryEngineImpl.java:183)
>         at org.apache.jackrabbit.oak.security.user.UserProvider.getAuthorizableByPrincipal(UserProvider.java:234)
>         at org.apache.jackrabbit.oak.security.user.UserManagerImpl.getAuthorizable(UserManagerImpl.java:116)
>         at org.apache.jackrabbit.oak.security.principal.PrincipalProviderImpl.getAuthorizable(PrincipalProviderImpl.java:140)
>         at org.apache.jackrabbit.oak.security.principal.PrincipalProviderImpl.getPrincipal(PrincipalProviderImpl.java:69)
>         at org.apache.jackrabbit.oak.spi.security.principal.CompositePrincipalProvider.getPrincipal(CompositePrincipalProvider.java:50)
>         at org.apache.jackrabbit.oak.spi.security.principal.PrincipalManagerImpl.getPrincipal(PrincipalManagerImpl.java:47)
>         at com.adobe.granite.repository.impl.SlingRepositoryManager.setupPermissions(SlingRepositoryManager.java:997)
>         at com.adobe.granite.repository.impl.SlingRepositoryManager.createRepository(SlingRepositoryManager.java:420)
>         at com.adobe.granite.repository.impl.SlingRepositoryManager.acquireRepository(SlingRepositoryManager.java:290)
>         at org.apache.sling.jcr.base.AbstractSlingRepositoryManager.start(AbstractSlingRepositoryManager.java:304)
>         at com.adobe.granite.repository.impl.SlingRepositoryManager.activate(SlingRepositoryManager.java:267)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:483)
>         at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
>         at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
>         at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
>         at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
>         at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)
>         at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302)
>         at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113)
>         at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:832)
>         at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:799)
>         at org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:724)
>         at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:927)
>         at org.apache.felix.scr.impl.manager.DependencyManager$SingleStaticCustomizer.addedService(DependencyManager.java:891)
>         at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1492)
>         at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1413)
>         at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:1222)
>         at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:1158)
>         at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1444)
>         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:987)
>         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:838)
>         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:545)
>         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4547)
>         at org.apache.felix.framework.Felix.registerService(Felix.java:3521)
>         at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:348)
>         at org.apache.sling.commons.threads.impl.Activator.start(Activator.java:55)
>         at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
>         at org.apache.felix.framework.Felix.activateBundle(Felix.java:2223)
>         at org.apache.felix.framework.Felix.startBundle(Felix.java:2141)
>         at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1368)
>         at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>         at java.lang.Thread.run(Thread.java:745)
> {noformat}
> Above exception happens at
> {code}
> for (String path : indexPaths) {
>             try {
>                 indexNode = tracker.acquireIndexNode(path);
>                 if (indexNode != null) {
>                     IndexPlan plan = new IndexPlanner(indexNode, path, filter, sortOrder).getPlan();
>                     if (plan != null) {
>                         plans.add(plan);
>                     }
>                 }
>             } finally {
>                 if (indexNode != null) {
>                     indexNode.release();
>                 }
>             }
>         }
> {code}
> It has been ensured that if indexNode is initialized then it has been acquired. So only
way for such an exception to happen is that in a loop of say 2 paths {{indexNode}} got initialized
for Loop 1 and then while acquiring in Loop 2 the indexNode still refers to old released value
and that would cause the exception. The fix should be simply to null the variable once released



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

Mime
View raw message