ERROR: Error during SonarScanner execution: The compiler execution timed out

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube server 9.6.1.59531
    SonarScanner 4.6.2.2472
    Windows Server 2019 10.0 amd64, running SonarScanner inside a Docker container.

  • what are you trying to achieve
    Run SonarScanner.

  • what have you tried so far to achieve this
    Run SonarScanner.

SonarScanner fails from time to time with the following error:

ERROR: Error during SonarScanner execution
[2022-10-12T06:49:47.807Z] java.lang.IllegalStateException: 
[2022-10-12T06:49:47.807Z] The compiler execution timed out, make sure that:
[2022-10-12T06:49:47.807Z] * the analysis is running on appropriate hardware
[2022-10-12T06:49:47.807Z] * eventual compiler license check over network is not taking too much time
[2022-10-12T06:49:47.807Z] The executed process: 
[2022-10-12T06:49:47.807Z]   [C:\Windows\system32\cmd.exe, /c, C:\Users\ContainerAdministrator\AppData\Local\Temp\vsinclude6421315687909477726.bat]
[2022-10-12T06:49:47.807Z] 
[2022-10-12T06:49:47.807Z] 	at com.sonar.cpp.driver.ProcessExecutor.execute(ProcessExecutor.java:60)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.analyzer.MsvcDriver.getIncludeFromDevCmd(MsvcDriver.java:545)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.analyzer.MsvcDriver.deduceIncludeFromClDir(MsvcDriver.java:529)
[2022-10-12T06:49:47.808Z] 	at java.base/java.util.HashMap.computeIfAbsent(Unknown Source)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.analyzer.MsvcDriver.onCapture(MsvcDriver.java:419)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.analyzer.CompilerDrivers.onCapture(CompilerDrivers.java:35)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.plugin.CFamilySensor.lambda$process$17(CFamilySensor.java:784)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.plugin.CompileCommandsReader.readCaptures(CompileCommandsReader.java:61)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:781)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:388)
[2022-10-12T06:49:47.808Z] 	at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:202)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:81)
[2022-10-12T06:49:47.808Z] 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
[2022-10-12T06:49:47.808Z] 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:396)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:392)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:361)
[2022-10-12T06:49:47.808Z] 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
[2022-10-12T06:49:47.808Z] 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
[2022-10-12T06:49:47.808Z] 	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:135)
[2022-10-12T06:49:47.808Z] 	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
[2022-10-12T06:49:47.808Z] 	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
[2022-10-12T06:49:47.808Z] 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
[2022-10-12T06:49:47.808Z] 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
[2022-10-12T06:49:47.808Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2022-10-12T06:49:47.808Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2022-10-12T06:49:47.808Z] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2022-10-12T06:49:47.808Z] 	at java.base/java.lang.reflect.Method.invoke(Unknown Source)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[2022-10-12T06:49:47.808Z] 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
[2022-10-12T06:49:47.808Z] 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
[2022-10-12T06:49:47.808Z] ERROR: 
[2022-10-12T06:49:47.808Z] ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
[2022-10-12T06:49:47.808Z]

This can happen when the device is under heavy load.
Is there any way to configure a bigger timeout for the above operation?

Thanks.

Hi @CristiN ,

currently, there is no way to customize the timeout which is set to 10 seconds.

Are you running other things in parallel inside the container?

Hi @mpaladin,

Yes, there could be other compilations happening at the same time. The CPU can be under heavy load for a prolonged period of time.

Hi @CristiN ,

the cfamily analyzer runs with multi-threading activated by default parallelizing to the max of available cores. If you have other heavy processes running in parallel you should either stop running them in parallel within the same container or reduce the number of threads of the cfamily analyzer.