Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FATAL] Could not startup process 'flutter analyze --no-fatal-warnings --no-fatal-infos'. #214

Open
DilanAriza opened this issue Apr 1, 2024 · 10 comments
Labels
bug Something isn't working waiting for feedback A feeback is necessary to investigate further

Comments

@DilanAriza
Copy link

DilanAriza commented Apr 1, 2024

I have version sonar-flutter-plugin-0.5.1-SNAPSHOT.jar and it seems to work fine, until I get to this point:
ERROR: Error during SonarScanner execution org.buildobjects.process.StartupException: Could not startup process 'flutter analyze --no-fatal-warnings --no-fatal-infos'. at org.buildobjects.process.Proc.<init>(Proc.java:91) at org.buildobjects.process.ProcBuilder.run(ProcBuilder.java:205) at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.executable.AnalyzerExecutable.analyze(AnalyzerExecutable.java:[88](https://github.com/PaymentsWayProjects/app_copiloto/actions/runs/8511360993/job/23310775882#step:9:89)) at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:67) at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88) at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61) at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79) at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61) at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82) at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:223) at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:202) at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:197) at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:193) at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:166) at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:223) at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:202) at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351) at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:223) at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:202) at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:138) at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:223) at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:202) at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71) at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:65) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) 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:1[89](https://github.com/PaymentsWayProjects/app_copiloto/actions/runs/8511360993/job/23310775882#step:9:90)) 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.IOException: Cannot run program "flutter" (in directory "/github/workspace"): 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 java.base/java.lang.Runtime.exec(Runtime.java:5[94](https://github.com/PaymentsWayProjects/app_copiloto/actions/runs/8511360993/job/23310775882#step:9:95)) at org.buildobjects.process.Proc.<init>(Proc.java:77) ... 36 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:314) at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244) at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110) ... 39 more ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

I read in this issue that someone obtained the solution to this problem by modifying the sonarqube scan permissions

          Fixed this was related to Sonar-Scanner permissions

Originally posted by @msaad2110 in #190 (comment)

this is my CI/CD
`

  • name: Run Flutter tests and generate coverage
    run: |
    flutter pub get
    flutter test
    flutter test --coverage --file-reporter "json:tests.output"
    • name: SonarQube Scan
      uses: sonarsource/sonarqube-scan-action@master
      env:
      SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
      SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
      with:
      args: >
      -Dsonar.flutter.projectProperties=./sonar-project.properties
      `

and my properties

`
sonar.projectKey=XXXXXX
sonar.projectName=XXXXXX
sonar.projectVersion=1.0

sonar.sourceEncoding=UTF-8
sonar.dart.analyzer.options.override=false

app.sonar.sources=lib,pubspec.yaml,pubspec_overrides.yaml,analysis_options.yaml
sonar.tests=test

app.sonar.projectBaseDir=lib/src

sonar.lang.patterns.dart=**/*.dart

sonar.java.binaries= /*.java
app.sonar.exclusions=
/*.g.dart

sonar.clean=true

app.sonar.dart.analyzer.report.mode=LEGACY
`

@SamiFala
Copy link

Same here

@zippy1978 zippy1978 added the bug Something isn't working label May 16, 2024
@0xbrigles
Copy link

Same on my side.

@Jcardif
Copy link

Jcardif commented Jun 14, 2024

same issue

INFO: Detected Flutter project with version 1.0.0+1
INFO: Using existing analysis_options.yaml since override is disabled
INFO: Running 'flutter [analyze, --no-fatal-warnings, --no-fatal-infos]'
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 33.162s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 16M/60M
org.buildobjects.process.StartupException: Could not startup process 'flutter analyze --no-fatal-warnings --no-fatal-infos'.
INFO: ------------------------------------------------------------------------
	at org.buildobjects.process.Proc.<init>(Proc.java:91)
	at org.buildobjects.process.ProcBuilder.run(ProcBuilder.java:205)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.executable.AnalyzerExecutable.analyze(AnalyzerExecutable.java:88)
	at fr.insideapp.sonarqube.dart.lang.issues.dartanalyzer.DartAnalyzerSensor.execute(DartAnalyzerSensor.java:67)
	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
	at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:204)
	at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:200)
	at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:173)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringScannerContainer.doAfterStart(SpringScannerContainer.java:351)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:138)
	at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:226)
	at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:71)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:[65](https://github.com/org/project.Mobile/actions/runs/9510648011/job/26215718508#step:7:66))
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:5[68](https://github.com/org/project.Mobile/actions/runs/9510648011/job/26215718508#step:7:69))
	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.IOException: Cannot run program "flutter" (in directory "/github/workspace/src"): 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:10[73](https://github.com/org/project.Mobile/actions/runs/9510648011/job/26215718508#step:7:74))
	at java.base/java.lang.Runtime.exec(Runtime.java:594)
	at org.buildobjects.process.Proc.<init>(Proc.java:77)
	... 36 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:314)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
	... 39 more
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

@luisangeldevops
Copy link

same issue over here. Same version of the plugin.

@Jane151013
Copy link

I‘ve tried the 0.5.2-snapshot,but the error is still happened.Waiting for the fixed version,tks

@zippy1978
Copy link
Contributor

Hi,

Seems to be the same issue as #225.

It seems to be related to the SonarQube action.

I need to setup a test project on GitHub action to figure it out.

In the meantime: you can run 'flutter analyze' outside of the SonarQube action and provide it directly in your sonar-project.properties.

@Jane151013
Copy link

Hi,

Seems to be the same issue as #225.

It seems to be related to the SonarQube action.

I need to setup a test project on GitHub action to figure it out.

In the meantime: you can run 'flutter analyze' outside of the SonarQube action and provide it directly in your sonar-project.properties.

Hi,zippy
Thank you for your answers.We have noticed our developers to put eyes on the reslut of 'flutter analyze'.
However,sonar-flutter plugin is the most convenient way to make the step automatic. So waiting for the fix version,TKS

@elcponce
Copy link

elcponce commented Sep 3, 2024

We encountered a similar issue with a custom Docker container in our organization. While debugging with strace, we identified an EACCES (Permission denied) error:

[pid  2013] execve("/opt/sonar-scanner/jre/lib/jspawnhelper", ["47:50"], 0x7fff85706198 /* 12 vars */) = -1 EACCES (Permission denied)
[pid  2013] exit_group(127)             = ?
[pid  1970] <... clone resumed>)        = 2013
[pid  2013] +++ exited with 127 +++
[pid  1970] wait4(2013, NULL, 0, NULL)  = 2013
[pid  1970] munmap(0x7f13bc7a9000, 36864) = 0
[pid  1970] rt_sigprocmask(SIG_SETMASK, [QUIT],  <unfinished ...>
[pid  1961] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=2013, si_uid=0, si_status=127, si_utime=0, si_stime=0} ---
[pid  1970] <... rt_sigprocmask resumed>NULL, 8) = 0 
[pid  1970] close(42)                   = 0

To resolve the issue, we gave the /opt/sonar-scanner/jre/lib/jspawnhelper binary execution permissions using chmod +x. After making this change, the scanner generated the report without errors.

This issue seems to only occur with JRE 17. https://community.sonarsource.com/t/embedded-jre-17-is-lacking-permissions-to-execute-programs

@zippy1978
Copy link
Contributor

Hi,
I created a sample project with GitHub Action here: https://github.com/insideapp-oss/sonar-flutter-example

@zippy1978 zippy1978 added the waiting for feedback A feeback is necessary to investigate further label Sep 7, 2024
@alaincruz06
Copy link

alaincruz06 commented Nov 25, 2024

I've encountered this error while running Sonarqube on a local env. (using Docker as Sonarqube env.) and testing a Flutter local app. No fix so far other than the action for GitHub?

My theory (since I'm using FVM as Flutter Version manager to have several Flutter versions available), is a conflict with FVM and Sonarqube/SonarScanner not able to locate the actual Flutter SDK path.

Edit: temporary fix - adding project's Flutter SDK to path will allow the scanner to run. (it's a hacky fix because I'll have to delete it afterwards)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for feedback A feeback is necessary to investigate further
Projects
None yet
Development

No branches or pull requests

9 participants