CFamily cache is not a valid line for pointer

Hi,

I am facing the following exception which seems to reoccur randomly about once a week, is there a way to stop this happening ?

  • Versions used
    SQ 8.5.1.38104 developer
  • Error observed
2021-01-04T09:22:17.4912823Z ##[error]ERROR: Error during SonarScanner execution
2021-01-04T09:22:17.4926166Z ERROR: Error during SonarScanner execution
2021-01-04T09:22:17.4927900Z ##[error]java.lang.IllegalStateException: C:\Agent\_work\24\s\<file path hidden>.h 8:7 8:20 S4963
2021-01-04T09:22:17.4929260Z java.lang.IllegalStateException: C:\Agent\_work\24\s\<file path hidden>.h 8:7 8:20 S4963
2021-01-04T09:22:17.4931191Z ##[error]at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:749)
	at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:711)
	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:581)
2021-01-04T09:22:17.4932629Z 	at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:749)
2021-01-04T09:22:17.4933197Z 	at com.sonar.cpp.plugin.CFamilySensor.save(CFamilySensor.java:711)
2021-01-04T09:22:17.4933784Z 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:581)
2021-01-04T09:22:17.4935396Z ##[error]at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:519)
2021-01-04T09:22:17.4936840Z 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:519)
2021-01-04T09:22:17.4939768Z ##[error]at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:339)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
2021-01-04T09:22:17.4942030Z 	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:339)
2021-01-04T09:22:17.4942980Z 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
2021-01-04T09:22:17.4944024Z 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
2021-01-04T09:22:17.4946161Z ##[error]at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
2021-01-04T09:22:17.4947911Z 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
2021-01-04T09:22:17.4952033Z ##[error]at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
2021-01-04T09:22:17.4954969Z 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
2021-01-04T09:22:17.4956049Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2021-01-04T09:22:17.4957065Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2021-01-04T09:22:17.4958066Z 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:393)
2021-01-04T09:22:17.4961453Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2021-01-04T09:22:17.4964480Z 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:389)
2021-01-04T09:22:17.4965760Z 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
2021-01-04T09:22:17.4966818Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2021-01-04T09:22:17.4968642Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2021-01-04T09:22:17.4970394Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2021-01-04T09:22:17.4972918Z ##[error]at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2021-01-04T09:22:17.4975131Z 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
2021-01-04T09:22:17.4976195Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
2021-01-04T09:22:17.4979131Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
2021-01-04T09:22:17.4981373Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2021-01-04T09:22:17.4982303Z 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
2021-01-04T09:22:17.4983102Z 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
2021-01-04T09:22:17.4984905Z ##[error]at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2021-01-04T09:22:17.4987074Z 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2021-01-04T09:22:17.4988553Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-01-04T09:22:17.4989902Z 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2021-01-04T09:22:17.4991595Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2021-01-04T09:22:17.4993197Z 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2021-01-04T09:22:17.4993925Z 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2021-01-04T09:22:17.4996356Z ##[error]at java.lang.reflect.Method.invoke(Unknown Source)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2021-01-04T09:22:17.4998202Z 	at java.lang.reflect.Method.invoke(Unknown Source)
2021-01-04T09:22:17.4999470Z 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2021-01-04T09:22:17.5000885Z ##[error]at com.sun.proxy.$Proxy0.execute(Unknown Source)
2021-01-04T09:22:17.5002189Z 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
2021-01-04T09:22:17.5003656Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2021-01-04T09:22:17.5005418Z 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2021-01-04T09:22:17.5009614Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalArgumentException: 28 is not a valid line for pointer. File <file path hidden>.h has 27 line(s)
2021-01-04T09:22:17.5012567Z 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2021-01-04T09:22:17.5013476Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
2021-01-04T09:22:17.5014305Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2021-01-04T09:22:17.5015085Z 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
2021-01-04T09:22:17.5016069Z Caused by: java.lang.IllegalArgumentException: 28 is not a valid line for pointer. File <file path hidden>.h has 27 line(s)
2021-01-04T09:22:17.5018583Z ##[error]at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:336)
2021-01-04T09:22:17.5020627Z 	at org.sonar.api.utils.Preconditions.checkArgument(Preconditions.java:43)
2021-01-04T09:22:17.5021626Z 	at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:336)
2021-01-04T09:22:17.5025041Z ##[error]at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
	at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:295)
	at com.sonar.cpp.plugin.CFamilySensor.rangeOrLine(CFamilySensor.java:845)
2021-01-04T09:22:17.5027570Z 	at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:272)
2021-01-04T09:22:17.5028638Z 	at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:295)
2021-01-04T09:22:17.5029602Z 	at com.sonar.cpp.plugin.CFamilySensor.rangeOrLine(CFamilySensor.java:845)
2021-01-04T09:22:17.5031735Z ##[error]at com.sonar.cpp.plugin.CFamilySensor.lambda$reportIssueImpl$10(CFamilySensor.java:787)
	at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
2021-01-04T09:22:17.5033704Z 	at com.sonar.cpp.plugin.CFamilySensor.lambda$reportIssueImpl$10(CFamilySensor.java:787)
2021-01-04T09:22:17.5034640Z 	at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
2021-01-04T09:22:17.5036413Z ##[error]at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
	at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
2021-01-04T09:22:17.5038401Z 	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source)
2021-01-04T09:22:17.5039149Z 	at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
2021-01-04T09:22:17.5040999Z ##[error]at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
2021-01-04T09:22:17.5042716Z 	at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
2021-01-04T09:22:17.5043488Z 	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source)
2021-01-04T09:22:17.5047486Z ##[error]at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source)
	at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
	at java.util.stream.ReferencePipeline.forEach(Unknown Source)
	at com.sonar.cpp.plugin.CFamilySensor.reportIssueImpl(CFamilySensor.java:793)
	at com.sonar.cpp.plugin.CFamilySensor.reportIssue(CFamilySensor.java:747)
	... 32 more
  • Steps to reproduce
    Appears randomly whilst in use

  • Potential workaround
    Delete CFamily cache on affected build machine

Hi @tjnashq,

if I send you a PM would you be able to share the entire output log?

Hi Massimo,

Yes I would be happy to share that.

Tom

PM sent.

Hi @tjnashq,

is the cache shared by parallel executors?

Hi @mpaladin,

I have the CFamily set to use multiple threads, but there is only ever a single scan being run per build agent at once. The cache is local to each agent so isn’t being accessed by other agents.

Hi @tjnashq,

ok, thanks for the clarification. The error could be caused by a caching hashing collision maybe caused by a bug in the logic. We didn’t get any other report, if you are still facing the issue with latest version it is going to be tough to reproduce and fix.