SonarQube Analyze Azure DevOps task reporting errors clearing out directories since v4.21.0 was released

  • SonarQube Server: 8.9.1 Community - On-prem
  • Azure DevOps pipelines
  • SonarQubeAnalyze task version 4.21.0

When running a build in Azure DevOps, since the release of the SonarQubeAnalyze task v4.21.0, .NET builds are producing errors as follows:

##[error]ERROR: Failed to delete temp folder
ERROR: Failed to delete temp folder
##[error]java.nio.file.DirectoryNotEmptyException: C:\buildTmp\_work\1\.sonarqube\out\.sonar\.sonartmp
	at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:271)
	at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
	at java.base/java.nio.file.Files.deleteIfExists(Files.java:1185)
	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.base/java.nio.file.Files.walkFileTree(Files.java:2822)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2876)
	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:150)
	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)
java.nio.file.DirectoryNotEmptyException: C:\buildTmp\_work\1\.sonarqube\out\.sonar\.sonartmp
	at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:271)
	at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
	at java.base/java.nio.file.Files.deleteIfExists(Files.java:1185)
	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.base/java.nio.file.Files.walkFileTree(Files.java:2822)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2876)
	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:150)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)

While this is not failing the build, it causing issues for our on-prem agents and we have to regularly clean out the work directory.

Hi @KrylixZA ,

Is this error happening on every run? Typically, anti-virus software may be interfering with your pipeline. As a test, please turn off your anti-virus software and confirm if the pipeline processes consistently. Then turn it back on and see if the error occurs again. If the anti-virus is the issue, then I suggest providing an exception for that directory C:\buildTmp\_work\1\.sonarqube\out\.sonar\.sonartmp.

Joe

Hey @Joe

Unfortunately disabling anti-virus software is something I will probably get fired for doing, but it does seem the issue has resolved itself.

Apologies for logging this issue here, will close and mark your response as the solution :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.