AzureDevops : SonarqubePrepare fails with exit code -529697949

Hello !

What i’m trying to achieve

I’m having some issues setting up Sonarqube with Azure Devops and i couldn’t find any other post similir to this problem.

The SonarQubePrepare@5 task fails after about two minutes with the following error :

[error]Exit code -529697949 returned from process: file name 'C:\azagent\A4\externals\node10\bin\node.exe', arguments '"C:\azagent\A4\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\prepare.js"'.

Context

I’m running Sonarqube Community Edition - Version 9.3 (build 51899) on an VM in Azure Cloud. I have an AzureDevops project hosted in Azure with SonarQube extension 5.4.0 and a Git repo hosted in azure as well.
My pipeline is running on a windows self-hosted agent (Windows 2019, OpenJDK11U-jre_x64).

The project is very small (one CS file and one JS file) as i’m just trying to do a POC.

Investigations

I’m pretty sure that the agent can join the Sonarqube server because i first had a certificate issues that i fixed using “NODE_EXTRA_CA_CERTS” variable.
I think the problem may be related to a ram issue because when looking at the task manager during execution the “node.exe” uses more than 5Go of ram (up to 100% utilization) and that’s when the task fails.

I’ve managed to run the analysis manually with SonnarScanner 4.7 without any issue.
I’ve also tried to run the pipeline in a azure hosted agent but it fails at the same step, but with a different error message (i can provide the full log if needed but I don’t know if this is relevant):

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Finally, i’ve enabled the debug mode and the verbose output with the hope of finding an error message with more detail, but no luck on this either.

So if anyone has any idea for more troublehsooting steps, how to find more logs, etc… i’m interessted !

This is my pipeline config:

trigger:
  branches:
    include:
    - main

variables:
- name: agentName
  value: 'aras-devops01'
- name : System.Debug
  value: true

stages:
 - stage: Code_Analysis
   jobs:
   - job : SonarQube_analysis     
     pool:
      name: Default
      demands:
      - agent.name -equals $(agentName)
     variables:
       NODE_EXTRA_CA_CERTS: $(System.DefaultWorkingDirectory)\CI-CD\internal.inensia.net_2.cer
       SONAR_SCANNER_OPTS: -Xmx2048m
       NODE_OPTIONS: --max-old-space-size=4096
     steps:
      # Prepare Analysis Configuration task
      - task: SonarQubePrepare@5
        inputs:
          SonarQube: 'Inensia Sonarqube'
          scannerMode: 'CLI'
          configMode: 'manual'
          cliProjectKey: 'INENSIA-Test-Project_TEST_CICD'
          cliSources: '$(System.DefaultWorkingDirectory)\convertedMethods'
      # Run Code Analysis task
      - task: SonarQubeAnalyze@5
      # Publish Quality Gate Result task
      - task: SonarQubePublish@5
        inputs:
          pollingTimeoutSec: '300'

And this is the full log output from Azure :

##[debug]loading INPUT_CLIPROJECTVERSION
##[debug]loading INPUT_CLISOURCES
##[debug]loading INPUT_CONFIGFILE
##[debug]loading INPUT_CONFIGMODE
##[debug]loading INPUT_EXTRAPROPERTIES
##[debug]loading INPUT_PROJECTKEY
##[debug]loading INPUT_PROJECTVERSION
##[debug]loading INPUT_SCANNERMODE
##[debug]loading INPUT_SONARQUBE
##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
##[debug]loaded 16
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SonarQube=0497ffba-ad41-4ff6-976b-e485578bac14
##[debug]0497ffba-ad41-4ff6-976b-e485578bac14=https://sonarqube.inensia.net/
##[debug]0497ffba-ad41-4ff6-976b-e485578bac14 auth param apitoken = undefined
##[debug]0497ffba-ad41-4ff6-976b-e485578bac14 auth param username = ***
##[debug]0497ffba-ad41-4ff6-976b-e485578bac14 auth param password = undefined
##[debug]organization=undefined
##[debug]scannerMode=MSBuild
##[debug]projectKey=INENSIA-Test-Project_TEST_CICD
##[debug]projectName=undefined
##[debug]projectVersion=1.0
##[debug]organization=undefined
##[debug][SQ] API GET: '/api/server/version' with query "undefined"
##[error]Exit code -529697949 returned from process: file name 'C:\azagent\A4\externals\node10\bin\node.exe', arguments '"C:\azagent\A4\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\prepare.js"'.
##[debug]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code -529697949 returned from process: file name 'C:\azagent\A4\externals\node10\bin\node.exe', arguments '"C:\azagent\A4\_work\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\prepare.js"'.
   at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.RunAsync()
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
Finishing: SonarQubePrepare

Thanks,
Alex

Hey there.

Any particular reason to set this?

Hello Colin,

I added this to prevent another error from hapenning.
I’ve just tried without it and this is the exact same error that happens when i run the pipeline in an azure hosted agent.

##[debug][SQ] API GET: '/api/server/version' with query "undefined"
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6617289AA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
 2: 00007FF6617034E6 node::MakeCallback+4534
 3: 00007FF661703E60 node_module_register+2032
 4: 00007FF661A22F4E v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF661A22E7F v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF661C09674 v8::internal::Heap::MaxHeapGrowingFactor+9620
 7: 00007FF661C00656 v8::internal::ScavengeJob::operator=+24550
 8: 00007FF661BFECAC v8::internal::ScavengeJob::operator=+17980
 9: 00007FF661C079F7 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF661C07A76 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF661D3199B v8::internal::Factory::AllocateRawWithImmortalMap+59
12: 00007FF661D3430D v8::internal::Factory::NewRawOneByteString+77
13: 00007FF661D33479 v8::internal::Factory::NewStringFromOneByte+121
14: 00007FF661D3355A v8::internal::Factory::NewStringFromUtf8+106
15: 00007FF661A3E74B v8::String::NewFromUtf8+363
16: 00007FF6615FDAC1 ENGINE_get_digests+66177
17: 00007FF6615FF0C3 ENGINE_get_digests+71811
18: 00007FF661611125 ENGINE_get_digests+145637
19: 00007FF661C35A62 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+79442
20: 00007FF661C36EED std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+84701
21: 00007FF661C35F46 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80694
22: 00007FF661C35E2B std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80411
23: 0000024007ADC6C1 
##[error]Exit code 134 returned from process: file name 'C:\agents\2.200.2\externals\node10\bin\node.exe', arguments '"D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\prepare.js"'.
##[debug]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code 134 returned from process: file name 'C:\agents\2.200.2\externals\node10\bin\node.exe', arguments '"D:\a\_tasks\SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157\5.4.0\prepare.js"'.
   at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.ProcessInvokerWrapper.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, InputQueue`1 redirectStandardIn, Boolean inheritConsoleHandler, Boolean keepStandardInOpen, Boolean highPriorityProcess, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.ExecuteAsync(String workingDirectory, String fileName, String arguments, IDictionary`2 environment, Boolean requireExitCodeZero, Encoding outputEncoding, Boolean killProcessOnCancel, Boolean inheritConsoleHandler, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.RunAsync()
   at Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.RunAsync()
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.RunStepAsync(IStep step, CancellationToken jobCancellationToken)
Finishing: SonarQubePrepare

Thanks for the update.

What other tasks do you have in your Azure DevOps Pipeline? I would be surprised if the SonarQube task was the only one affected – as most other Azure DevOps tasks are node-based.

Hello Colin,

The other tasks in my pipeline are just calling powershell scripts, and they work well.
Do you want me to add a specific task to see if it’s a node issue ?

Thanks,
Alex

You could try, for example, the Node.JS tool installer task.

Hello Colin,

Sorry for the delay, i just tried to add the Node.JS install task to the pipeline :

      - task: NodeTool@0
        inputs:
          versionSpec: 6.x

This new task works, but the prepare task still fails with this error message :

FATAL ERROR: MarkCompactCollector: semi-space copy, fallback in old gen Allocation failed - JavaScript heap out of memory

Hello @Colin,

I’ve installed another sonarqube server and now the pipeline is working ! I don’t know what caused the issue with the first server but i’ll let you know if I find it !

Thanks for your help !

Alex,