Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2616

ModeShapeEngine.undeploy() throws IllegalStateException "already closed" with local indexing provider

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 5.1.0.Final
    • Fix Version/s: 5.2.0.Final
    • Component/s: None
    • Labels:
      None

      Description

      If ModeShapeEngine.undeploy() on a repository using the local index provider is called from a JVM shutdown hook, e.g. in the case of a spring managed scenario, then sometimes MapDB throws an IllegalArgumentException "already done".

      The problem is that it is possible that the shutdown hook registered via MapDB by LocalIndexProvider's use of DBMaker.closeOnJvmShutdown() will be called prior to the call to undeploy() and subsequently LocalIndexProvider.postShutdown().

      This should be as simple as adding a guard using db.isClosed() to postShutdown().

      Thrown exception:

      java.util.concurrent.ExecutionException: java.lang.IllegalAccessError: already closed
      	at java.util.concurrent.FutureTask.report(Unknown Source)
      	at java.util.concurrent.FutureTask.get(Unknown Source)
      	at com.lavastorm.lae.repository2.jcr.modeshape.impl.SimpleModeshapeRepositoryProvider.destroyJcrRepository(SimpleModeshapeRepositoryProvider.java:183)
      	at com.lavastorm.lae.repository2.jcr.impl.AbstractJcrRepositoryProvider.destroyRepository(AbstractJcrRepositoryProvider.java:147)
      	at com.lavastorm.lae.repository2.jcr.impl.AbstractJcrRepositoryProvider.destroyRepositories(AbstractJcrRepositoryProvider.java:139)
      	at com.lavastorm.lae.repository2.jcr.impl.AbstractJcrRepositoryProvider.destroy(AbstractJcrRepositoryProvider.java:133)
      	at com.lavastorm.lae.repository2.jcr.modeshape.impl.SimpleModeshapeRepositoryProvider.destroy(SimpleModeshapeRepositoryProvider.java:173)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:349)
      	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeDestroyMethods(InitDestroyAnnotationBeanPostProcessor.java:314)
      	at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeDestruction(InitDestroyAnnotationBeanPostProcessor.java:153)
      	at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:239)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:907)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:914)
      	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:908)
      	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:884)
      	at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:804)
      Caused by: java.lang.IllegalAccessError: already closed
      	at org.mapdb.EngineWrapper$1.commit(EngineWrapper.java:502)
      	at org.mapdb.EngineWrapper.commit(EngineWrapper.java:94)
      	at org.mapdb.DB.commit(DB.java:1643)
      	at org.modeshape.jcr.index.local.LocalIndexProvider.postShutdown(LocalIndexProvider.java:183)
      	at org.modeshape.jcr.spi.index.provider.IndexProvider.shutdown(IndexProvider.java:362)
      	at org.modeshape.jcr.RepositoryIndexManager.shutdown(RepositoryIndexManager.java:255)
      	at org.modeshape.jcr.RepositoryQueryManager.shutdown(RepositoryQueryManager.java:144)
      	at org.modeshape.jcr.JcrRepository$RunningState.shutdown(JcrRepository.java:1652)
      	at org.modeshape.jcr.JcrRepository.doShutdown(JcrRepository.java:398)
      	at org.modeshape.jcr.JcrRepository.lambda$shutdown$1(JcrRepository.java:311)
      	at java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.lang.Thread.run(Unknown Source)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                mbachmann Matthew Bachmann
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: