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

Valgrind parsing error #759

Closed
schiean opened this issue Jan 18, 2016 · 2 comments · Fixed by #799
Closed

Valgrind parsing error #759

schiean opened this issue Jan 18, 2016 · 2 comments · Fixed by #799
Labels
Milestone

Comments

@schiean
Copy link

schiean commented Jan 18, 2016

Hi,

When I run sonar cxx on one of the valgrind reports of my projects, it fails to parse properly.
It seems to appear on the line '

' which contains a weird value "////////////////home/user/src...."
I think it might fail to handle the large number of slashes.

Although it seems valgrind just sometimes has invalid output, I thought I's share the 'issue' here.
Below is the stacktrace.

The 'problem' is that the method 'isInside()' gets a null-path.

"".equals(path) ? false : path.startsWith(folder);

This line fails if path == null , because it ends up in the else branch.
A quick fix could be to change it into path==null || "".equals(path) ? false : path.startsWith(folder);
But im not sure if that is really the right way.

We decided to fixed it by preprocessing the valgrind file in shell script, since I'm not sure if this error is common in any way.

ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:90)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:41)
Caused by: java.lang.IllegalStateException: Cannot feed the data into sonar, details: 'java.lang.NullPointerException'
at org.sonar.plugins.cxx.utils.CxxReportSensor.analyse(CxxReportSensor.java:128)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:119)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:194)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:233)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:228)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:226)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:221)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:125)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:93)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:78)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:173)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: java.lang.NullPointerException
at org.sonar.plugins.cxx.valgrind.ValgrindStack.isInside(ValgrindStack.java:90)
at org.sonar.plugins.cxx.valgrind.ValgrindStack.getLastOwnFrame(ValgrindStack.java:82)
at org.sonar.plugins.cxx.valgrind.ValgrindError.getLastOwnFrame(ValgrindError.java:80)
at org.sonar.plugins.cxx.valgrind.CxxValgrindSensor.saveErrors(CxxValgrindSensor.java:75)
at org.sonar.plugins.cxx.valgrind.CxxValgrindSensor.processReport(CxxValgrindSensor.java:70)
at org.sonar.plugins.cxx.utils.CxxReportSensor.analyse(CxxReportSensor.java:109)
... 35 more

@guwirth guwirth added this to the M 0.9.5 milestone Jan 30, 2016
@guwirth
Copy link
Collaborator

guwirth commented Jan 30, 2016

@schiean it's always the question how tolerant the analyzer should be, see also discussion in #758

' which contains a weird value "////////////////home/user/src...."

It's for sure an invalid path. analyzer should break with an error or give an warning. Throwing an exception is for sure wrong.

@guwirth guwirth added bug and removed question labels Feb 9, 2016
@guwirth
Copy link
Collaborator

guwirth commented Feb 9, 2016

The 'problem' is that the method 'isInside()' gets a null-path.

"".equals(path) ? false : path.startsWith(folder);

This line fails if path == null , because it ends up in the else branch.
A quick fix could be to change it into path==null || "".equals(path) ? false : path.startsWith(folder);
But im not sure if that is really the right way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants