Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-9973

"java.lang.IllegalStateException: load called twice" error prevents any new analysis

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.6
    • Fix Version/s: 6.7
    • Component/s: Compute Engine
    • Labels:

      Description

      Under some conditions, an error during the processing of an analysis can lead to any new analysis running on the Thread of this task to fail with an error such as the following:

      java.lang.IllegalStateException: load called twice for thread 'ce-worker-0' or state wasn't cleared last time it was used
      	at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
      	at org.sonar.server.setting.ThreadLocalSettings.load(ThreadLocalSettings.java:137)
      	at org.sonar.ce.settings.SettingsLoader.start(SettingsLoader.java:43)
      	at sun.reflect.GeneratedMethodAccessor461.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
      	at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
      	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
      	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
      	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
      	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
      	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
      	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
      	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
      	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
      	at org.sonar.server.computation.task.container.TaskContainerImpl.<init>(TaskContainerImpl.java:44)
      	at org.sonar.server.computation.task.projectanalysis.container.ContainerFactoryImpl.create(ContainerFactoryImpl.java:32)
      	at org.sonar.server.computation.task.projectanalysis.taskprocessor.ReportTaskProcessor.process(ReportTaskProcessor.java:72)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.executeTask(CeWorkerImpl.java:92)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:59)
      	at org.sonar.ce.taskprocessor.CeWorkerImpl.call(CeWorkerImpl.java:35)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      

      The problem is the following:
      in case of Error (such as OutOfMemoryException), task container is stopped. But if the stop method of a component throws an exception, stop methods of other components are not called, which implies that some resources may not be released cleanly.

      (pb reported on mailing list at least once: https://groups.google.com/d/msg/sonarqube/lZffOd9NOWA/GIxWOuWDAQAJ)

        Attachments

          Activity

            People

            • Assignee:
              sebastien.lesaint Sebastien Lesaint
              Reporter:
              sebastien.lesaint Sebastien Lesaint
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: