Intermittent exception “unexpanded response file” with IAR on Windows (SonarQube 8.9)
I took the recommended course of action and spun up a SonarQube 8.9 instance with the bundled
CFamily plugin, but still got the same exception.
Previous Thread:
When running sonar-scanner over an IAR build output on Windows, an “unexpanded response file”
exception is sometimes raised.
java.lang.IllegalStateException: unexpanded response file
at com.sonar.cpp.analyzer.IarDriver.onCapture(IarDriver.java:95)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:586)
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:366)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
... (full stacktrace included below)
I added a retry to the sonar-scanner step, but the same exception would always happen in
that case. Maybe this suggests the build wrapper output goes bad? I checked the
build-wrapper.log and found the following error:
ERROR: error opening file for UTF-16 checking: C:\Users\bamboo\AppData\Local\Temp\EW8A2F.tmp
error reading file: C:\Users\bamboo\AppData\Local\Temp\EW8A2F.tmp
As you would expect, this is not present when the build succeeds. The particular file that
causes the exception is inconsistent, and given the same commit, sometimes the exception will
not occur at all. The file in question exists on the filesystem, is accessible, and according
to notepad++ is UTF-8 with BOM, if that matters.
I attempted to exclude the executables and paths involved from Microsoft Defender, thinking
that maybe it was holding a read lock when scanning files that sonar-scanner attempted to use,
but this did not seem to solve the issue either.
Are there any ideas as to what may be going wrong here? Is this addressed in the next LTS
version? I can send the build-wrapper.log
and build-wrapper-dump.json
in a private chat if
it helps.
Versions
Sonar
- CSS Code Quality and Security 1.4.2.2002 (cssfamily)
- PL/SQL Code Quality and Security 3.6.1.3873 (plsql)
- Scala Code Quality and Security 1.8.3.2219 (sonarscala)
- C# Code Quality and Security 8.22.0.31243 (csharp)
- Vulnerability Analysis 8.9.0.11439 (security)
- Java Code Quality and Security 6.15.1.26025 (java)
- HTML Code Quality and Security 3.4.0.2754 (web)
- Flex Code Quality and Security 2.6.1.2564 (flex)
- XML Code Quality and Security 2.2.0.2973 (xml)
- VB.NET Code Quality and Security 8.22.0.31243 (vbnet)
- Swift Code Quality and Security 4.3.1.4892 (swift)
- CFamily Code Quality and Security 6.20.0.31240 (cpp)
- Python Code Quality and Security 3.4.1.8066 (python)
- Go Code Quality and Security 1.8.3.2219 (go)
- JaCoCo 1.1.1.1157 (jacoco)
- Kotlin Code Quality and Security 1.8.3.2219 (kotlin)
- T-SQL Code Quality and Security 1.5.1.4340 (tsql)
- JavaScript/TypeScript Code Quality and Security 7.4.2.15501 (javascript)
- Ruby Code Quality and Security 1.8.3.2219 (ruby)
- Vulnerability Rules for C# 8.9.0.11439 (securitycsharpfrontend)
- Vulnerability Rules for Java 8.9.0.11439 (securityjavafrontend)
- License for SonarLint 8.9.0.43852 (license)
- Vulnerability Rules for JS 8.9.0.11439 (securityjsfrontend)
- Vulnerability Rules for Python 8.9.0.11439 (securitypythonfrontend)
- PHP Code Quality and Security 3.17.0.7439 (php)
- ABAP Code Quality and Security 3.9.1.3127 (abap)
- Vulnerability Rules for PHP 8.9.0.11439 (securityphpfrontend)
Other
Windows 10 10.0 amd64
iccarm.exe ANSI C/C++ Compiler V8.11.3.13950/W32 for ARM
IarBuild.exe IAR Command Line Build Utility V8.0.10.5001
Java 1.8.0_201 Oracle Corporation (64-bit)
Atlassian Bamboo version 7.1
Backtrace
error 14-Jul-2021 12:50:57 java.lang.IllegalStateException: unexpanded response file
error 14-Jul-2021 12:50:57 at com.sonar.cpp.analyzer.IarDriver.onCapture(IarDriver.java:95)
error 14-Jul-2021 12:50:57 at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:586)
error 14-Jul-2021 12:50:57 at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:366)
error 14-Jul-2021 12:50:57 at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:175)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
error 14-Jul-2021 12:50:57 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
error 14-Jul-2021 12:50:57 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:392)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:388)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:357)
error 14-Jul-2021 12:50:57 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
error 14-Jul-2021 12:50:57 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
error 14-Jul-2021 12:50:57 at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:150)
error 14-Jul-2021 12:50:57 at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
error 14-Jul-2021 12:50:57 at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
error 14-Jul-2021 12:50:57 at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
error 14-Jul-2021 12:50:57 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
error 14-Jul-2021 12:50:57 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
error 14-Jul-2021 12:50:57 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
error 14-Jul-2021 12:50:57 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error 14-Jul-2021 12:50:57 at java.lang.reflect.Method.invoke(Method.java:498)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
error 14-Jul-2021 12:50:57 at com.sun.proxy.$Proxy0.execute(Unknown Source)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
error 14-Jul-2021 12:50:57 at org.sonarsource.scanner.cli.Main.main(Main.java:61)
build-wrapper.log
...
process created with pid: 8148
image path name: <C:\Program Files (x86)\IAR Systems\ARM\8113\arm\bin\iccarm.exe>
command line: <"C:/Program Files (x86)\IAR Systems\ARM\8113\arm\bin\iccarm.exe" "--IDE2" "-f" "C:\Users\bamboo\AppData\Local\Temp\EWB6CA.tmp">
working directory: <C:\MSA\build-dir\HOP-HFST0-JOB1\Source\Rx\HardwareLayer\PE\Project\Generated_Code\>
isWow64: 1
{{ ERROR: error opening file for UTF-16 checking: C:\Users\bamboo\AppData\Local\Temp\EWB6CA.tmp}}
error reading file: C:\Users\bamboo\AppData\Local\Temp\EWB6CA.tmp
...
sonar-project.properties
sonar.projectKey=<...redacted...>
sonar.projectName=<...redacted...>
sonar.sources=Source
sonar.exclusions=<...redacted...>
sonar.language=c
sonar.c.std=c99
sonar.sourceEncoding=windows-1252
sonar.links.homepage=<...redacted...>
sonar.links.ci=<...redacted...>
sonar.links.issue=<...redacted...>
sonar.links.scm=<...redacted...>
sonar.cfamily.build-wrapper-output=Source/BuildOutput/sonar
sonar.scm.exclusions.disabled = True
Sonar launch configuration
git bash for windows
:
"C:\BuildTools\sonar-scanner\bin\sonar-scanner.bat" \
-Dsonar.branch.name=develop \
-Dsonar.projectVersion=0.0.15 \
-Dsonar.verbose=true \
-Dsonar.cfamily.build-wrapper-output=BuildOutput/sonar-build-wrapper \
-Dsonar.host.url=http://10.16.5.212:9000 \
-X -e
Windows Defender Exclusions
Folder: C:\MSA\build-dir
File type: C:\Users\bamboo\AppData\Local\Temp\EW*.tmp
Process: C:\BuildTools\sonar-build-wrapper-win-x86\build-wrapper-win-x86-64.exe
Process: C:\BuildTools\sonar-scanner\bin\sonar-scanner.bat
Process: C:\Program Files (x86)\IAR Systems*
Process: C:\Program Files (x86)\IAR Systems\ARM\8113\arm\bin\iccarm.exe
Process: C:\Program Files (x86)\IAR Systems\ARM\8113\common\bin\IarBuild.exe
Process: C:\Program Files\Git\bin\git.exe
Process: C:\VCAST2020*