GitHub Action scanning timing out

  • ALM used: GitHub
  • CI system used: GitHub - Ubuntu 8 Core runner
  • Scanner command used when applicable (private details masked)
.sonar/scanner/dotnet-sonarscanner begin /k:"**hiddenProjectName**" /o:"**hiddenOrgName**" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.language=cs /d:sonar.exclusions=**/bin/**/*,**/obj/**/*
dotnet build ClientPortal.sln --configuration Release
.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
  • Languages of the repository: C#
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
2023-10-26T01:55:16.6084560Z INFO: ------------- Run sensors on module **HiddenProjectName**
2023-10-26T01:55:16.6267078Z INFO: Sensor JaCoCo XML Report Importer [jacoco]
2023-10-26T01:55:16.6268779Z INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
2023-10-26T01:55:16.6270254Z INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
2023-10-26T01:55:16.6271064Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
2023-10-26T01:55:16.6271614Z INFO: Sensor IaC CloudFormation Sensor [iac]
2023-10-26T01:55:16.7273477Z INFO: 0 source files to be analyzed
2023-10-26T01:55:16.7274332Z INFO: 0/0 source files have been analyzed
2023-10-26T01:55:16.7275062Z INFO: Sensor IaC CloudFormation Sensor [iac] (done) | time=101ms
2023-10-26T01:55:16.7275696Z INFO: Sensor IaC Kubernetes Sensor [iac]
2023-10-26T01:55:16.7294053Z INFO: 0 source files to be analyzed
2023-10-26T01:55:16.7315471Z INFO: 0/0 source files have been analyzed
2023-10-26T01:55:16.7316309Z INFO: Sensor IaC Kubernetes Sensor [iac] (done) | time=4ms
2023-10-26T01:55:16.7317227Z INFO: Sensor IaC AzureResourceManager Sensor [iac]
2023-10-26T01:55:16.7318310Z INFO: Sensor IaC AzureResourceManager Sensor is restricted to changed files only
2023-10-26T01:55:16.7326849Z INFO: 0 source files to be analyzed
2023-10-26T01:55:16.7327611Z INFO: 0/0 source files have been analyzed
2023-10-26T01:55:16.7328599Z INFO: Sensor IaC AzureResourceManager Sensor [iac] (done) | time=1ms
2023-10-26T01:55:16.7329711Z INFO: Sensor JavaScript/TypeScript analysis [javascript]
2023-10-26T02:16:57.9393754Z ##[debug]Re-evaluate condition on job cancellation for step: 'Analyze'.
2023-10-26T02:17:10.5199215Z ##[error]The operation was canceled.
  • Steps to reproduce
    Add commit to the PR

  • Potential workaround
    If I change the GitHub runner to be Windows it works.

Of interest, we see every project in our solution go through this same process:

2023-10-26T01:55:16.4086125Z INFO: ------------- Run sensors on module ** Hidden .Net Project Name **
2023-10-26T01:55:16.4256839Z INFO: Sensor JaCoCo XML Report Importer [jacoco]
2023-10-26T01:55:16.4260019Z INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
2023-10-26T01:55:16.4262023Z INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
2023-10-26T01:55:16.4262873Z INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=0ms
2023-10-26T01:55:16.4263438Z INFO: Sensor CSS Rules [javascript]
2023-10-26T01:55:16.4263951Z INFO: Sensor CSS Rules is restricted to changed files only
2023-10-26T01:55:16.4264710Z INFO: No CSS, PHP, HTML or VueJS files are found in the project. CSS analysis is skipped.
2023-10-26T01:55:16.4265442Z INFO: Sensor CSS Rules [javascript] (done) | time=0ms
2023-10-26T01:55:16.4266032Z INFO: Sensor ThymeLeaf template sensor [securityjavafrontend]
2023-10-26T01:55:16.4270262Z INFO: Sensor ThymeLeaf template sensor [securityjavafrontend] (done) | time=1ms
2023-10-26T01:55:16.4271278Z INFO: Sensor C# Project Type Information [csharp]
2023-10-26T01:55:16.4271811Z INFO: Sensor C# Project Type Information [csharp] (done) | time=0ms
2023-10-26T01:55:16.4272677Z INFO: Sensor C# Analysis Log [csharp]
2023-10-26T01:55:16.4273214Z INFO: Roslyn version: 4.7.0.0
2023-10-26T01:55:16.4273595Z INFO: Language version: CSharp11
2023-10-26T01:55:16.4274178Z INFO: Concurrent execution: enabled
2023-10-26T01:55:16.4274894Z INFO: Sensor C# Analysis Log [csharp] (done) | time=0ms
2023-10-26T01:55:16.4275368Z INFO: Sensor C# Properties [csharp]
2023-10-26T01:55:16.4275780Z INFO: Sensor C# Properties [csharp] (done) | time=0ms
2023-10-26T01:55:16.4276214Z INFO: Sensor TextAndSecretsSensor [text]
2023-10-26T01:55:16.4276729Z INFO: Sensor TextAndSecretsSensor is restricted to changed files only
2023-10-26T01:55:16.4514973Z INFO: 50 source files to be analyzed
2023-10-26T01:55:16.6055190Z INFO: 50/50 source files have been analyzed
2023-10-26T01:55:16.6056255Z INFO: Sensor TextAndSecretsSensor [text] (done) | time=178ms
2023-10-26T01:55:16.6057358Z INFO: Sensor VB.NET Project Type Information [vbnet]
2023-10-26T01:55:16.6058771Z INFO: Sensor VB.NET Project Type Information [vbnet] (done) | time=0ms
2023-10-26T01:55:16.6059858Z INFO: Sensor VB.NET Analysis Log [vbnet]
2023-10-26T01:55:16.6060801Z INFO: Sensor VB.NET Analysis Log [vbnet] (done) | time=0ms
2023-10-26T01:55:16.6061744Z INFO: Sensor VB.NET Properties [vbnet]
2023-10-26T01:55:16.6062673Z INFO: Sensor VB.NET Properties [vbnet] (done) | time=0ms
2023-10-26T01:55:16.6063816Z INFO: Sensor IaC Docker Sensor [iac]
2023-10-26T01:55:16.6064419Z INFO: Sensor IaC Docker Sensor is restricted to changed files only
2023-10-26T01:55:16.6064927Z INFO: 0 source files to be analyzed
2023-10-26T01:55:16.6076694Z INFO: 0/0 source files have been analyzed
2023-10-26T01:55:16.6077485Z INFO: Sensor IaC Docker Sensor [iac] (done) | time=2ms
2023-10-26T01:55:16.6078367Z INFO: Sensor Serverless configuration file sensor [security]
2023-10-26T01:55:16.6079300Z INFO: 0 Serverless function entries were found in the project
2023-10-26T01:55:16.6080278Z INFO: 0 Serverless function handlers were kept as entrypoints
2023-10-26T01:55:16.6081123Z INFO: Sensor Serverless configuration file sensor [security] (done) | time=0ms
2023-10-26T01:55:16.6081733Z INFO: Sensor AWS SAM template file sensor [security]
2023-10-26T01:55:16.6082308Z INFO: Sensor AWS SAM template file sensor [security] (done) | time=0ms
2023-10-26T01:55:16.6083153Z INFO: Sensor AWS SAM Inline template file sensor [security]
2023-10-26T01:55:16.6083777Z INFO: Sensor AWS SAM Inline template file sensor [security] (done) | time=0ms

But it fails when the “module” is the Sonar “Project”

Hi,

Welcome to the community!

Can you provide a full debug log, please?

This guide will tell you how to get it.

 
Ann

Can I supply this log privately please? It will need to go through our agencies security process if I upload it publicly.

Hi,

Feel free to redact as necessary.

And I’ve flagged this for more expert eyes, as well.

 
Ann

logs_174325.zip (1.1 MB)
I got permission to upload unredacted because it would have taken me a day to look through it all.

Hi,

Thanks for the logs!

 
Ann

Is there any update on this? Our trial has finished and we are paying for a product we cant use.

Hi @drwharris

I’m sorry for the delay. From the logs I can see that the job is cancelled exactly after 10 minutes. Could it be that the GitHub runner has some specific timeout configuration?

Also, is timeout the reason for cancelling the task?

Anita

Hi there, this is the github runner timeout. I have had it as high as 25min and the same thing happens. It just sits there on that same step.

Thank you for the reply!

Do you know how long SonarCloud analysis takes for your project when you successfully run on Windows?

Also, could you attach the analysis logs with the longer timeout set (with DEBUG, as the ones you attached above)? I’d like to see whether the execution stops in exactly the same place or it goes further.

Moreover, do you have any JavaScript/TypeScript files in your repository (besides C#?)

Anita

logs_180823-UbuntuRunner.zip (1.3 MB)
logs_180800-WIndowsRunner.zip (1.8 MB)

Logs from Windows and Ubuntu runners with 30 min timeout. On Windows, the analysis step completes in about 14 min (In itself way to slow to be running on PR). On Ubuntu, it times out after 30 min.

Windows runner is default (2 cores?), Ubuntu is 8 cores.

Yes we have javascript.

Thank you for more details @drwharris !

I’ll consult this issue with JS/TS experts, the analysis execution hangs on JavaScript/TypeScript sensor step, and for both timeout settings it stops axactly at the same place.

Regarding slow PR analysis, I’d suggest to start a separate community thread about it - it’s easier for us to keep one topic per thread.

Anita

hello @drwharris,

sorry for the inconvenience, it seems to be that we might have memory leak issue in our JS analyzer. Could you please add the following options to your analysis to troubleshoot the problem?

sonar.javascript.node.debugMemory=true

You can either add this with /d:sonar.javascript.node.debugMemory=true on the command line, or add the property in the sonar-project.properties

If you need to unblock the analysis on Ubuntu, I would suggest to exclude JS/TS files by setting -Dsonar.exclusions=**/*.js,**/*.ts. This will exclude all js/ts files from the analysis and should allow the analysis to pass.

Hi There, attached are the logs with the debugMemory=true.

logs_Ubuntu-MemoryLogs.zip (1.3 MB)

I have also run with

/d:sonar.exclusions=**/*.js,**/*.ts

(Note /d: instead of -D as written) and it has still not succeeded.

logs_182970-UbuntuExcludeJs.zip (1.2 MB)

@drwharris I noticed something strange in the logs, on Windows the generated sonar-project.properties seems to have correct sonar.projectBaseDir

2023-11-07T04:55:05.7333237Z 04:55:05.169  Dumping content of sonar-project.properties
2023-11-07T04:55:05.7334232Z ------------------------------------------------------------------------
2023-11-07T04:55:05.7335036Z sonar.projectKey=CleanEnergyRegulator_amazon
2023-11-07T04:55:05.7336091Z sonar.working.directory=D:\\a\\amazon\\amazon\\.sonarqube\\out\\.sonar
2023-11-07T04:55:05.7377519Z sonar.projectBaseDir=D:\\a\\amazon\\amazon
2023-11-07T04:55:05.7378301Z sonar.pullrequest.cache.basepath=D:\\a\\amazon\\amazon
2023-11-07T04:55:05.7379022Z sonar.sources=\
2023-11-07T04:55:05.7753049Z "D:\\a\\amazon\\amazon\\.editorconfig",\
2023-11-07T04:55:05.7753788Z "D:\\a\\amazon\\amazon\\xunit.runner.json"

However on Ubuntu it’s set to /

2023-11-09T11:42:32.0580084Z 11:42:31.025  Dumping content of sonar-project.properties
2023-11-09T11:42:32.0580328Z ------------------------------------------------------------------------
2023-11-09T11:42:32.0580511Z sonar.projectKey=CleanEnergyRegulator_amazon
2023-11-09T11:42:32.0580963Z sonar.working.directory=/home/runner/work/amazon/amazon/.sonarqube/out/.sonar
2023-11-09T11:42:32.0581181Z sonar.projectBaseDir=/
2023-11-09T11:42:32.0581519Z sonar.pullrequest.cache.basepath=/home/runner/work/amazon/amazon
2023-11-09T11:42:32.0581617Z sonar.sources=\
2023-11-09T11:42:32.0582159Z "/home/runner/.nuget/packages/microsoft.net.test.sdk/17.7.1/build/netcoreapp3.1/Microsoft.NET.Test.Sdk.Program.cs",\
2023-11-09T11:42:32.0582669Z "/home/runner/.nuget/packages/microsoft.net.test.sdk/17.3.2/build/netcoreapp2.1/Microsoft.NET.Test.Sdk.Program.cs",\
2023-11-09T11:42:32.0583120Z "/home/runner/.nuget/packages/microsoft.playwright/1.37.1/.playwright/node/linux-x64/node",\

is there any difference how you run the scan? It seems that on Ubuntu scan is picking up many unrelated files.

All I ever do is change the runner type, so whatever is working for windows is the same for Ubuntu.

Setting the projectBaseDir explicitly now allows the analysis to complete properly.

Ive now got analysis happening and I have setup a separate step for code coverage but I am not getting any coverage reports. Any ideas?
logs_183544-CodeCoverage.zip (1.1 MB)

Hi @drwharris

Could you start a new thread regarding the coverage issue? It really makes it easier for us to keep just one topic per thread :slight_smile:

Anita

1 Like

Done. Thank you