java.io.IOException: Cannot run program

Hi,

We are considering to switch from SonarQube Community Edition to Developer Edition. One of our code base could not analyzed by sonarqube scanner in developer edition. Scanner failed with an error[1]. In community edition scanner was able to completed successfully. Our sales representative does not provide any help.

  • SonarQube Version: 10.6 Developer Edition Trial Edition
  • how is SonarQube deployed: Docker
  • steps: in ci file there is such configuration to run sonarqube scanner. I switched scanner host address, token and project key.
sonarqube-check:
  image:
    name: sonarsource/sonar-scanner-cli:10.0
    entrypoint: [""]
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"
    GIT_DEPTH: "0"
    SONAR_SCANNER_JAVA_OPTS: "-Xmx512m"
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script:
    - sonar-scanner -Dsonar.qualitygate.wait=true -X
  • what have you tried so far to achieve this:
  • I tried to increase RAM limit with SONAR_SCANNER_OPTS and -Xmx512m

[1]

20:37:46.933 ERROR: Exception in thread pool-5-thread-1
java.lang.IllegalStateException: java.io.IOException: Cannot run program "/builds/metunic/app/blesta/.scannerwork/.sonartmp/11672376920307524952/subprocess" (in directory "."): error=2, No such file or directory
    at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:74)
    at com.sonar.cpp.plugin.CFamilySensor$AutoScanUtils.generateAutoScanMacros(CFamilySensor.java:939)
    at com.sonar.cpp.plugin.CFamilySensor$AutoScanUtils.lambda$generateAutoScanMacros$2(CFamilySensor.java:864)
    at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:58)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.io.IOException: Cannot run program "/builds/metunic/app/blesta/.scannerwork/.sonartmp/11672376920307524952/subprocess" (in directory "."): error=2, No such file or directory
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
    at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:72)
    ... 8 common frames omitted
Caused by: java.io.IOException: error=2, No such file or directory
    at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
    at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
    at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
    at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
    ... 10 common frames omitted

Hey @caglary,

It seems that you have C and C++ code.
C and C++ code started to be supported with docker recently through AutoConfig mode.

The issues that you are facing are because older scanner docker images used Alpine, and C&C++ analysis isn’t supported on Alpine.

The issue should be fixed by bumping sonar-scanner-cli:10.0 to 11.1.

Thanks,

3 Likes

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