Sonar-scanner in sonarscanner docker fails to execute

  • versions used:
    • SonarQube server: Enterprise EditionVersion 8.9 (build 43852)
    • Scanner: SonarScanner 4.6.2.2472 (available via docker image sonarsource/sonar-scanner-cli@sha256:c782340526ea4fc21226dd325da7724beb130ff756b53583387dd6aca26d3a59
  • error observed (after the files are initially detected, once the plugin of the language is starting to run, it fails:
15:22:53.386 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: java.io.IOException: Cannot run program "/src/module/.scannerwork/.sonartmp/17249610217304622426/subprocess" (in directory "."): error=2, No such file or directory
        at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:80)
        at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:50)
        at com.sonar.cpp.plugin.CFamilySensor.lambda$process$8(CFamilySensor.java:718)
        at com.sonar.cpp.analyzer.AnalysisExecutor.lambda$submit$0(AnalysisExecutor.java:59)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: Cannot run program "/src/module/.scannerwork/.sonartmp/17249610217304622426/subprocess" (in directory "."): error=2, No such file or directory
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
        at com.sonar.cpp.analyzer.Subprocess.execute(Subprocess.java:78)
        ... 8 more
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:340)
        at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:271)
        at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
        ... 10 more
  • steps to reproduce:
    just run sonar-scanner on a C project built with build-wrapper

  • potential workaround

    1. use a debian/ubuntu based image
    2. download the scanner zip file
    3. set the JRE_PATH pointing at zip’s jre

the error message does not help to determine what exactly is missing.
But it seems the alpine image is either missing a java library OR a system tool is missing, but overall.

Hi @mvk ,

there is a warning on the github project and on the docker bup page about that:

Warning: These Docker images are not compatible with C/C++/Objective-C projects.

you need to natively run the scanner with build wrapper

1 Like

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