"java.io.IOException: The cache stream is too big" when running the scanner in our repository

We use the Sonar Scanner (version 4.8.0.2856-linux) to analyze our code (Ruby on Rails + EmberJS) and it pushes the results to SonarCloud.
We run the scanner in the Heroku CI, just after the test execution to collect the coverage information.

It’s been working for several months without problems.

Since yesterday, we have this error when the analysis is launched :

.08:05:42.075 ERROR: Failure when reading cache entry

java.io.IOException: The cache stream is too big (>26143) for file /app/.scannerwork/ucfg2/js/_Users_reminuyts_workspace_prospectio_front_app_index_html.ucfgs
at org.sonar.plugins.javascript.eslint.cache.SequenceSerialization.writeFile(SequenceSerialization.java:91)
at org.sonar.plugins.javascript.eslint.cache.SequenceSerialization.readFromCache(SequenceSerialization.java:139)
at org.sonar.plugins.javascript.eslint.cache.UCFGFilesSerialization.readFromCache(UCFGFilesSerialization.java:60)
at org.sonar.plugins.javascript.eslint.cache.CacheAnalysisSerialization.readFromCache(CacheAnalysisSerialization.java:58)
at org.sonar.plugins.javascript.eslint.cache.CacheStrategies.readFromCache(CacheStrategies.java:124)
at org.sonar.plugins.javascript.eslint.cache.CacheStrategies.getStrategyFor(CacheStrategies.java:105)
at org.sonar.plugins.javascript.eslint.cache.CacheStrategies.getStrategyFor(CacheStrategies.java:69)
at org.sonar.plugins.javascript.eslint.HtmlSensor.analyzeFiles(HtmlSensor.java:89)
at org.sonar.plugins.javascript.eslint.AbstractEslintSensor.execute(AbstractEslintSensor.java:73)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:62)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:66)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:48)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:468)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:464)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:420)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:130)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
at og.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
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)

Sonar analysis finished.

In the Sonarcloud UI, we can see that the analysis was triggered (X minutes ago), but we don’t see the bugs, code smells, coverage information,… All the values are displayed as 0.

We didn’t change anything specific from our side in the project. It appears at the same time on master and features branches. The scanner version hasn’t changed.

When we execute the scanner in the same version but from our Macbooks, the analysis works correctly.

I tried to provide more memory (-XmX parameter) to the scanner but apparently, it’s not a memory issue.

I think it could be explained by a potential change Heroku did from their side regarding the testing environment (OS,…). This could explain why it stopped working without any change on our side…

Any idea how we could fix this annoying issue?

Thank you in advance for you help!

I just found out what was the cause of the issue.

It was coming from a very long line in the index.html mentioned here in the error message : The cache stream is too big (>26143) for file /app/.scannerwork/ucfg2/js/_Users_reminuyts_workspace_prospectio_front_app_index_html.ucfgs

I’ve split this into shorter lines and now the scanner analysis works correctly.
What is strange is that this line is present in the index.html for months and it never caused issues before yesterday.

Hi,

Welcome to the community!

Thanks for following up when you figured out the problem. This will be invaluable for future users. :star_struck:

To be clear,

was it your file that you split into shorter lines, or a cache file downloaded from the server?

 
Thx,
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.