Failure to load server rules using Sonar Scanner ( InvalidProtocolBufferException )

scanner

(Eric Siegal) #1

I have an instance of SonarQube installed on a server of mine, and I am trying to run scans on Atlassian’s Bamboo using the Sonar Scanner. When I attempt to run a scan the following error is thrown.

I am using the following version: Bamboo: v6.6.1 SonarQube: v6.5 SonarScanner: 3.0.3.778

An extra bit of detail is that this error did not start happening for all builds at a specific time. One day this error was only showing up every 3-4 builds, and you could rebuild the same code and it didn’t show up. But over a period of two weeks it appeared more and more until now where it will not go away.

12:32:16.533 INFO: Load server rules
build   04-Sep-2018 12:32:16    12:32:16.587 DEBUG: GET 200 http://<url>/api/rules/list.protobuf | time=53ms
build   04-Sep-2018 12:32:16    12:32:16.597 INFO: ------------------------------------------------------------------------
build   04-Sep-2018 12:32:16    12:32:16.597 INFO: EXECUTION FAILURE
build   04-Sep-2018 12:32:16    12:32:16.597 INFO: ------------------------------------------------------------------------
build   04-Sep-2018 12:32:16    12:32:16.597 INFO: Total time: 2.399s
build   04-Sep-2018 12:32:16    12:32:16.644 INFO: Final Memory: 46M/211M
build   04-Sep-2018 12:32:16    12:32:16.644 INFO: ------------------------------------------------------------------------
build   04-Sep-2018 12:32:16    12:32:16.647 DEBUG: Execution getVersion
build   04-Sep-2018 12:32:16    12:32:16.647 DEBUG: Execution stop
error   04-Sep-2018 12:32:16    12:32:16.644 ERROR: Error during SonarQube Scanner execution
error   04-Sep-2018 12:32:16    java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.sensor.DefaultSensorStorage
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:71)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:283)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:261)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:256)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:245)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:119)
error   04-Sep-2018 12:32:16        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
error   04-Sep-2018 12:32:16        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error   04-Sep-2018 12:32:16        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
error   04-Sep-2018 12:32:16        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error   04-Sep-2018 12:32:16        at java.lang.reflect.Method.invoke(Method.java:498)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
error   04-Sep-2018 12:32:16        at com.sun.proxy.$Proxy0.execute(Unknown Source)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
error   04-Sep-2018 12:32:16        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
error   04-Sep-2018 12:32:16    Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.issue.ModuleIssues
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:71)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
error   04-Sep-2018 12:32:16        at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
error   04-Sep-2018 12:32:16        at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
error   04-Sep-2018 12:32:16        at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
error   04-Sep-2018 12:32:16        at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)
error   04-Sep-2018 12:32:16        ... 28 more
error   04-Sep-2018 12:32:16    Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:71)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
error   04-Sep-2018 12:32:16        at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
error   04-Sep-2018 12:32:16        at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
error   04-Sep-2018 12:32:16        at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
error   04-Sep-2018 12:32:16        at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)
error   04-Sep-2018 12:32:16        ... 42 more
error   04-Sep-2018 12:32:16    Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.api.batch.rule.Rules
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:71)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:621)
error   04-Sep-2018 12:32:16        at org.picocontainer.containers.ImmutablePicoContainer.getComponent(ImmutablePicoContainer.java:40)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:718)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)
error   04-Sep-2018 12:32:16        ... 56 more
error   04-Sep-2018 12:32:16    Caused by: java.lang.IllegalStateException: Unable to get rules
error   04-Sep-2018 12:32:16        at org.sonar.scanner.rule.DefaultRulesLoader.loadFromStream(DefaultRulesLoader.java:51)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.rule.DefaultRulesLoader.load(DefaultRulesLoader.java:43)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.rule.RulesProvider.load(RulesProvider.java:47)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.rule.RulesProvider.provide(RulesProvider.java:40)
error   04-Sep-2018 12:32:16        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error   04-Sep-2018 12:32:16        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
error   04-Sep-2018 12:32:16        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error   04-Sep-2018 12:32:16        at java.lang.reflect.Method.invoke(Method.java:498)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.MethodInjector.invokeMethod(MethodInjector.java:129)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.MethodInjector.access$000(MethodInjector.java:39)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.MethodInjector$2.run(MethodInjector.java:113)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.MethodInjector.decorateComponentInstance(MethodInjector.java:120)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.CompositeInjector.decorateComponentInstance(CompositeInjector.java:58)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.Reinjector.reinject(Reinjector.java:142)
error   04-Sep-2018 12:32:16        at org.picocontainer.injectors.ProviderAdapter.getComponentInstance(ProviderAdapter.java:96)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
error   04-Sep-2018 12:32:16        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
error   04-Sep-2018 12:32:16        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)
error   04-Sep-2018 12:32:16        ... 61 more
error   04-Sep-2018 12:32:16    Caused by: com.google.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
error   04-Sep-2018 12:32:16        at com.google.protobuf.InvalidProtocolBufferException.invalidTag(InvalidProtocolBufferException.java:89)
error   04-Sep-2018 12:32:16        at com.google.protobuf.CodedInputStream.readTag(CodedInputStream.java:158)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse$Rule.<init>(Rules.java:214)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse$Rule.<init>(Rules.java:184)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse$Rule$1.parsePartialFrom(Rules.java:1036)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse$Rule$1.parsePartialFrom(Rules.java:1030)
error   04-Sep-2018 12:32:16        at com.google.protobuf.CodedInputStream.readMessage(CodedInputStream.java:495)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse.<init>(Rules.java:90)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse.<init>(Rules.java:46)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse$1.parsePartialFrom(Rules.java:1609)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse$1.parsePartialFrom(Rules.java:1603)
error   04-Sep-2018 12:32:16        at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:192)
error   04-Sep-2018 12:32:16        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:210)
error   04-Sep-2018 12:32:16        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:215)
error   04-Sep-2018 12:32:16        at com.google.protobuf.AbstractParser.parseFrom(AbstractParser.java:49)
error   04-Sep-2018 12:32:16        at org.sonarqube.ws.Rules$ListResponse.parseFrom(Rules.java:1154)
error   04-Sep-2018 12:32:16        at org.sonar.scanner.rule.DefaultRulesLoader.loadFromStream(DefaultRulesLoader.java:49)
error   04-Sep-2018 12:32:16        ... 79 more

(Nicolas Bontoux) #2

Hi Eric,

That seems to indicate some data problem. Unfortunately you’re on fairly old SonarQube version here, it would be best if you could get on top of all latest improvements.

In the meantime you may want to rebuild your ElasticSearch index: stop SQ, delete data/es5, restart. Note that subsequent startup may take slightly longer than usual, due to ES data rebuild (which is not a usual operation, always better to investigate it first as you did here).


Reactivate deactivated user