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

SCM Sensor may fail when enabling assertions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.2
    • Component/s: Scanner, Scm
    • Labels:
      None

      Description

      When an SCM plugin blames files in parallel then SCM measures are stored "from" different threads. There is an assertion in persistit to prevent that since persistit Exchange is not concurrent safe.
      In fact everything works because DefaultBlameOutput#blameResult is synchronized so only one thread can write at the same time.

      But enabling assertions (-ea) will produce following error:

      java.lang.AssertionError: Thread Thread[pool-125-thread-1,5,main] must not use Exchange(Volume=/home/jenkins/workspace/workspace/Petals Components - SE Camel/target/sonar/.sonartmp/caches/persistit_tempvol_1184728435649328060.tmp,Tree=measures,,Key=<{"org.ow2.petals:petals-camel-parent:pom.xml","ncloc","ncloc||"}>) owned by Thread[main,5,main]
          at com.persistit.Exchange.assertCorrectThread(Exchange.java:4128)
          at com.persistit.Exchange.getKey(Exchange.java:942)
          at com.persistit.Exchange.clear(Exchange.java:701)
          at org.sonar.batch.index.Cache.resetKey(Cache.java:339)
          at org.sonar.batch.index.Cache.containsKey(Cache.java:141)
          at org.sonar.batch.scan.measure.MeasureCache.contains(MeasureCache.java:81)
          at org.sonar.batch.index.DefaultIndex.addMeasure(DefaultIndex.java:244)
          at org.sonar.batch.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:116)
          at org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.doSave(DefaultMeasure.java:107)
          at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:45)
          at org.sonar.batch.scm.ScmSensor.saveMeasures(ScmSensor.java:134)
          at org.sonar.batch.scm.DefaultBlameOutput.blameResult(DefaultBlameOutput.java:90)
          at org.sonar.plugins.scm.git.JGitBlameCommand.blame(JGitBlameCommand.java:146)
          at org.sonar.plugins.scm.git.JGitBlameCommand.access$000(JGitBlameCommand.java:45)
          at org.sonar.plugins.scm.git.JGitBlameCommand$1.call(JGitBlameCommand.java:113)
          at org.sonar.plugins.scm.git.JGitBlameCommand$1.call(JGitBlameCommand.java:110)
          at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      

        Attachments

          Activity

            People

            Assignee:
            julien.henry Julien Henry
            Reporter:
            henryju OLD - Julien HENRY
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: