ERROR for large source code projects (>2Mb zipped report result): Failed to delete temp folder DirectoryNotEmptyException: .sonarqube\out\.sonar\.sonartmp

We are using Azure Devops Server 2019 on-premise with SonarQube Developer Edition

  • Version 8.3.1 (build 34397)

Every time we run analysis on large project with deleting .sonartmp folder after analysis is finished:

##[error]ERROR: Failed to delete temp folder
java.nio.file.DirectoryNotEmptyException: E:\Builds\Default\1\w\205\.sonarqube\out\.sonar\.sonartmp
	at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
	at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
ERROR: Failed to delete temp folder
java.nio.file.DirectoryNotEmptyException: E:\Builds\Default\1\w\205\.sonarqube\out\.sonar\.sonartmp
	at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
	at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
##[error]at java.nio.file.Files.deleteIfExists(Unknown Source)
	at org.sonar.api.impl.utils.DefaultTempFolder$DeleteRecursivelyFileVisitor.postVisitDirectory(DefaultTempFolder.java:121)
	at org.sonar.api.impl.utils.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.impl.utils.DefaultTempFolder.clean(DefaultTempFolder.java:97)
	at org.sonar.api.impl.utils.DefaultTempFolder.stop(DefaultTempFolder.java:106)
	at org.sonar.scanner.analysis.AnalysisTempFolderProvider.stop(AnalysisTempFolderProvider.java:61)
	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:166)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:125)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.nio.file.Files.deleteIfExists(Unknown Source)
	at org.sonar.api.impl.utils.DefaultTempFolder$DeleteRecursivelyFileVisitor.postVisitDirectory(DefaultTempFolder.java:121)
	at org.sonar.api.impl.utils.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.impl.utils.DefaultTempFolder.clean(DefaultTempFolder.java:97)
	at org.sonar.api.impl.utils.DefaultTempFolder.stop(DefaultTempFolder.java:106)
	at org.sonar.scanner.analysis.AnalysisTempFolderProvider.stop(AnalysisTempFolderProvider.java:61)
	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:166)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:125)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
##[error]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 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)
INFO: Total time: 51.297s
##[error]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)
	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)

We believe it is not an issue since .sonartmp folder is being cleaned up next time analysis is running, so possibly we could live with warning/info in the logs output instead of exception:

I Just upgraded to 8.3.1 and have the same problem.
Also working with azure devops 2019 on premise.

1 Like

do you have any antivirus scanners and how large is your out folder under .sonar?

We have antivirus scanners
The out folder is 2.3 m
I have a smaller project that succeeded (17K lines of code rather than 45k), that came out the same size

1 Like

Are the results uploaded to the sonar server? In my case this is a real exception, I do not have result in the sonar

Results are fine, just annoying red messages in between all green onesโ€ฆ