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.driver.B.A(na:3058)
at com.sonar.cpp.driver.I$_A.A(na:3490)
at com.sonar.cpp.driver.I.A(na:3164)
at com.sonar.cpp.driver.I.A(na:3302)
... (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\EWB6CA.tmp
error reading file: C:\Users\bamboo\AppData\Local\Temp\EWB6CA.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. I then tried disabling Real-time
protection entirely, as suggested here
and here,
but I still got the same failure. No other antivirus is installed on this machine.
Are there any ideas as to what may be going wrong here? Is this addressed in the next LTS
version? I should be able to send the build-wrapper.log
and build-wrapper-dump.json
in a
private chat if it helps. Thank you for your time.
Versions
Sonar
- SonarQube 7.9.1 Developer Edition (build 27448)
- SonarScanner 2.6.1 (4.6.0.2311 also tested, same result)
- build-wrapper, version 5.1 (win-x86-64)
- SonarCSS 1.1.1.1010 (cssfamily)
- Crowd 2.1.3 (crowd)
- Svn 1.9.0.1295 (scmsvn)
- Ansible Lint 2.2.0 (ansible)
- SonarPLSQL 3.4.1.2576 (plsql)
- SonarC# 7.16.0.8981 (csharp)
- Vulnerability Analysis 7.9.0.5105 (security)
- SonarJava 5.14.0.18788 (java)
- SonarHTML 3.2.0.2082 (web)
- SonarXML 2.0.1.2020 (xml)
- SonarTS 2.1.0.4359 (typescript)
- Cloudformation 2.0.9 (cloudformation)
- YAML Analyzer 1.5.2 (yaml)
- C++ (Community) 1.3.1.1807 (cxx)
- SonarCFamily 5.1.1.10386 (cpp)
- SonarPython 2.0.0.5043 (python)
- JaCoCo 1.0.2.475 (jacoco)
- SonarGo 1.6.0.719 (go)
- SonarTSQL 1.4.0.3334 (tsql)
- SonarJS 6.2.2.13315 (javascript)
- Vulnerability Rules for C# 7.9.0.5105 (securitycsharpfrontend)
- Vulnerability Rules for Java 7.9.0.5105 (securityjavafrontend)
- License for SonarLint 7.9.1 (license)
- Git 1.11.1.2008 (scmgit)
- SonarPHP 3.2.0.4868 (php)
- Vulnerability Rules for PHP 7.9.0.5105 (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
java.lang.IllegalStateException: unexpanded response file
at com.sonar.cpp.driver.B.A(na:3058)
at com.sonar.cpp.driver.I$_A.A(na:3490)
at com.sonar.cpp.driver.I.A(na:3164)
at com.sonar.cpp.driver.I.A(na:3302)
at com.sonar.cpp.plugin.B.A(na:289)
at com.sonar.cpp.plugin.Q.A(na:1544)
at com.sonar.cpp.plugin.Q.execute(na:292)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:62)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:400)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:395)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:358)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
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
:
mkdir -p BuildOutput/sonar-build-wrapper
C:\BuildTools\sonar-build-wrapper-win-x86\build-wrapper-win-x86-64.exe \
--out-dir BuildOutput/sonar-build-wrapper
C:\BuildTools\sonar-scanner\bin\sonar-scanner.bat \
-Dsonar.branch.name=$(bamboo_planRepository_branchName) \
-Dsonar.projectVersion=0.0.$(bamboo_buildNumber) \
-Dsonar.verbose=true \
-Dsonar.cfamily.build-wrapper-output=BuildOutput/sonar-build-wrapper \
-Dsonar.host.url=$(bamboo_sonar_host_url) \
-X -e
Windows Defender Exclusions
-
Folder:
C:\MSA\build-dir
-
File type:
C:\Users\bamboo\AppData\Local\Temp\EW*.tmp
-
Folder:
C:\Users\bamboo\AppData\Local\Temp
-
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\*