SonarQube TFS 2015 extenstion: Failed to delete temp folder

I just noticed in the TFS 2015 build log that the temp file created by SonarQube can’t be deleted off the build server? I’m not sure what account needs permissions to delete from that temp folder. (see log below)

Is the SonarQube temp directory location configurable?


INFO: ANALYSIS SUCCESSFUL, you can browse http://sonar:8999/dashboard/index/CSAT_CiTest
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://sonar:8999/api/ce/task?id=AWYv15eSsWWXFlPmyb7j
INFO: Task total time: 15.578 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 25.391s
INFO: Final Memory: 65M/236M
INFO: ------------------------------------------------------------------------

ERROR: Failed to delete temp folder

java.nio.file.DirectoryNotEmptyException: C:\Users\TFSBuild_CSAT_SVCACC.sonar.sonartmp_2476308829446478892
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
at java.nio.file.Files.deleteIfExists(Unknown Source)
at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileVisitor.postVisitDirectory(DefaultTempFolder.java:121)
at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileVisitor.postVisitDirectory(DefaultTempFolder.java:110)
at java.nio.file.Files.walkFileTree(Unknown Source)
at java.nio.file.Files.walkFileTree(Unknown Source)
at org.sonar.api.utils.internal.DefaultTempFolder.clean(DefaultTempFolder.java:97)
at org.sonar.api.utils.internal.DefaultTempFolder.stop(DefaultTempFolder.java:106)
at org.sonar.scanner.bootstrap.GlobalTempFolderProvider.stop(GlobalTempFolderProvider.java:160)
at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContainer.java:1048)
at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java:803)
at org.sonar.core.platform.ComponentContainer.stopComponents(ComponentContainer.java:164)
at org.sonar.batch.bootstrapper.Batch.doStop(Batch.java:156)
at org.sonar.batch.bootstrapper.Batch.stop(Batch.java:151)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.stop(BatchIsolatedLauncher.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.stop(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doStop(EmbeddedScanner.java:226)
at org.sonarsource.scanner.api.EmbeddedScanner.stop(EmbeddedScanner.java:165)
at org.sonarsource.scanner.cli.Main.execute(Main.java:86)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
The SonarQube Scanner has finished

Thanks

1 Like

Hi!

We also have this issue in our MSBuild builds.
It appears to be a timing issue, because it does not happen on every build (all run on the same machine).
Also we have only seen it happen on short-lived branches. But that is maybe due to the infrequent runs of the long-living branches.

We have:

  • Sonarqube: LTS 6.7.5
  • SonarC#: 7.7
  • Sonar MSBuild Scanner Net4.6: 4.4.2
  • Java on build machine: 1.8.191

The error output is the same as the one of above.

This error is bothering us because subsequent steps in our build.xml are skipped and our CI environment stops the build process after this failing task. We might be able to ignore this error, but thats not really convenient.

Thanks