Details

      Description

      After upgrade to latest versions of Sonar and Flex plugin some code analysis has started to fail.

      Full stack trace here:

      INFO: Rules number in the ruleSet: 85
      Oct 29, 2012 1:03:16 PM de.bokelberg.flex.parser.AS3Scanner$XMLVerifier verify
      WARNING: The markup in the document preceding the root element must be well-formed. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
      org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      [ERROR] Java heap space -> [Help 1]
      java.lang.OutOfMemoryError: Java heap space
      	at java.util.Arrays.copyOf(Arrays.java:2894)
      	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117)
      	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:407)
      	at java.lang.StringBuffer.append(StringBuffer.java:241)
      	at de.bokelberg.flex.parser.AS3Parser.parseMetaData(AS3Parser.java:1577)
      	at de.bokelberg.flex.parser.AS3Parser.parseClassContent(AS3Parser.java:157)
      	at de.bokelberg.flex.parser.AS3Parser.parseClass(AS3Parser.java:942)
      	at de.bokelberg.flex.parser.AS3Parser.parsePackageContent(AS3Parser.java:290)
      	at de.bokelberg.flex.parser.AS3Parser.parsePackage(AS3Parser.java:1768)
      	at de.bokelberg.flex.parser.AS3Parser.parseCompilationUnit(AS3Parser.java:204)
      	at de.bokelberg.flex.parser.AS3Parser.parseLines(AS3Parser.java:1554)
      	at de.bokelberg.flex.parser.AS3Parser.buildAst(AS3Parser.java:109)
      	at com.adobe.ac.pmd.files.FileSetUtils.tryToBuildAst(FileSetUtils.java:182)
      	at com.adobe.ac.pmd.files.FileSetUtils.buildAst(FileSetUtils.java:78)
      	at com.adobe.ac.pmd.FlexPmdViolations.computeAsts(FlexPmdViolations.java:126)
      	at com.adobe.ac.pmd.FlexPmdViolations.computeAsts(FlexPmdViolations.java:109)
      	at com.adobe.ac.pmd.FlexPmdViolations.computeViolations(FlexPmdViolations.java:88)
      	at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.computeViolations(AbstractFlexPmdEngine.java:142)
      	at com.adobe.ac.pmd.engines.AbstractFlexPmdEngine.executeReport(AbstractFlexPmdEngine.java:119)
      	at org.sonar.plugins.flex.flexpmd.FlexPmdSensor.execute(FlexPmdSensor.java:85)
      	at org.sonar.plugins.flex.flexpmd.FlexPmdSensor.analyse(FlexPmdSensor.java:63)
      	at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
      	at org.sonar.batch.phases.Phases.execute(Phases.java:97)
      	at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:128)
      	at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      	at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:114)
      	at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:104)
      	at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      	at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121)
      	at org.sonar.batch.bootstrap.Module.start(Module.java:83)
      	at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:73)
      	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:60)
      

      I've increased my java heap space to 2GB in order to give it a try, but I don't think that's exactly a problem with my machine.

      I've tried with different quality profiles (new default and a previous existing one) but it doesn't make any difference.

      Also, another quality analysis has stop working on another complex project. In that case the anylisis hangs forever.

        Issue Links

          Activity

          Hide
          Miguel Martín-Forero added a comment - - edited

          I also tried using a Sonar Runner and the problem persists: it gives an OutOfMemory error no matter how much max heap size it is assigned (and it occures very fast).

          It only works if it has 0 active rules and fails with only 1 active rule (I've tried activating different rules but this doesn't help).

          Info about my JDK installation:
          java version "1.7.0_07"
          OpenJDK Runtime Environment (IcedTea7 2.3.2) (7u7-2.3.2a-0ubuntu0.12.04.1)
          OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)

          Show
          Miguel Martín-Forero added a comment - - edited I also tried using a Sonar Runner and the problem persists: it gives an OutOfMemory error no matter how much max heap size it is assigned (and it occures very fast). It only works if it has 0 active rules and fails with only 1 active rule (I've tried activating different rules but this doesn't help). Info about my JDK installation: java version "1.7.0_07" OpenJDK Runtime Environment (IcedTea7 2.3.2) (7u7-2.3.2a-0ubuntu0.12.04.1) OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
          Hide
          Miguel Martín-Forero added a comment -

          I've finally come to a solution (I don't know if it deserve to be called a workaround though) to these problems.

          I was having two related issues:

          • An OutOfMemory error whichs was triggered very fast.
          • An analysis that was hanging forever

          These problems were provoked by two different files.

          1. The OutOfMemory was caused by this code: <fx:Script fb:purpose="styling">. Removing the fb:purpose="styling" part solved the issue.
          2. Analysis freeze was cause by a single comment inside a switch case block ... :S like the following one:
          if (condition) {
          switch (value)

          { /* A harmless comment? */ case option: ... }

          }

          Removing the comment solved it too.

          I've reduced the original code for cleanliness.

          Hope this helps to solve these issues in the plugin itself.

          Show
          Miguel Martín-Forero added a comment - I've finally come to a solution (I don't know if it deserve to be called a workaround though) to these problems. I was having two related issues: An OutOfMemory error whichs was triggered very fast. An analysis that was hanging forever These problems were provoked by two different files. 1. The OutOfMemory was caused by this code: <fx:Script fb:purpose="styling">. Removing the fb:purpose="styling" part solved the issue. 2. Analysis freeze was cause by a single comment inside a switch case block ... :S like the following one: if (condition) { switch (value) { /* A harmless comment? */ case option: ... } } Removing the comment solved it too. I've reduced the original code for cleanliness. Hope this helps to solve these issues in the plugin itself.
          Hide
          OLD - Evgeny Mandrikov added a comment - - edited

          Hi Miguel,

          Thanks for your analysis! Now it's absolutely clear that both problems come from FlexPMD, which we want to fully replace by SSLR. And actually I don't see other ways to solve the issue since it comes from FlexPMD, which is out of our responsibility and we don't want to continue hacking/patching it.

          Show
          OLD - Evgeny Mandrikov added a comment - - edited Hi Miguel, Thanks for your analysis! Now it's absolutely clear that both problems come from FlexPMD, which we want to fully replace by SSLR. And actually I don't see other ways to solve the issue since it comes from FlexPMD, which is out of our responsibility and we don't want to continue hacking/patching it.
          Hide
          Miguel Martín-Forero added a comment -

          Hi Evgeny,

          thank you very much for your comment. Hoping to see the replacement of the buggy FlexPMD by SSLR soon

          In the meantime, I'll try to avoid these problems in order to have a happier developer life. fb:purpose="styling" shouldn't be in my code in the first place. I'm a little more worried about the second issue: this problem demonstrate the buggyness of FlexPMD.

          Show
          Miguel Martín-Forero added a comment - Hi Evgeny, thank you very much for your comment. Hoping to see the replacement of the buggy FlexPMD by SSLR soon In the meantime, I'll try to avoid these problems in order to have a happier developer life. fb:purpose="styling" shouldn't be in my code in the first place. I'm a little more worried about the second issue: this problem demonstrate the buggyness of FlexPMD.
          Hide
          Mark Diskin added a comment -

          Any update on the switch to SSLR. I've just tried to use it on the small flex (with sonar,jenkins,flexmojos) and got the OOM.

          Show
          Mark Diskin added a comment - Any update on the switch to SSLR. I've just tried to use it on the small flex (with sonar,jenkins,flexmojos) and got the OOM.
          Hide
          OLD - Linda Martin added a comment -

          Fixed as part of SONARPLUGINS-2413.

          Show
          OLD - Linda Martin added a comment - Fixed as part of SONARPLUGINS-2413 .
          Hide
          Freddy Mallet added a comment -

          Manually tested!

          Show
          Freddy Mallet added a comment - Manually tested!

            People

            • Assignee:
              OLD - Linda Martin
              Reporter:
              Miguel Martín-Forero
            • Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: