Run Code Analysis task in Azure DevOps suddenly failing with disk space error

Hello

SonarCloud has been running fine in our Azure DevOps YAML pipeline for many months, scanning C#, HTML, JavaScript and VB.NET. The other day though the Run Code Analysis task suddenly started erroring with issues like this:

##[error]at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$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:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: java.io.FileNotFoundException: D:\a\1\.sonarqube\out\.sonar\scanner-report\changesets-1740.pb (There is not enough space on the disk)
	at java.base/java.io.FileOutputStream.open0(Native Method)
	at java.base/java.io.FileOutputStream.open(FileOutputStream.java:293)
	at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
	at org.sonar.scanner.protocol.output.Protobuf.write(Protobuf.java:54)
	... 27 more

The previous day before the errors started I’d merged a topic branch in to the branch being scanned, but that doesn’t seem to have changed anything fundamental such as lines of code.

The Run Code Analysis task is running on an Azure DevOps agent, which feels like it ought to have plenty of disk space. Could disk space really be the issue?

Grateful for any help on working out how to fix this.

Thanks - Graham

Hey @Graham

I think a good first debugging step would be adding a Get-PSDrive powershell script to your build to understand disk space before the SonarQubeAnalyze task runs. That should at least tell you the state of disk space at various points in your build.

Thanks for that @Colin! Get-PSDrive now added to several parts of the pipeline and…I’m feeling foolish for having jumped to conclusions. Turns out the Azure Agent VM/container has a D volume of 14GB and our application build is using nearly all the disk space leaving hardly anything for SonarCloud.

On further investigation it looks like our application has a new feature which has caused the amount of disk space used during the build to significantly increase from one pipeline run to the next. Time for some optimisation…

1 Like