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

sonar CXX plugin sonar scan can't finish when it found can't find resources #1588

Closed
liucc52 opened this issue Nov 14, 2018 · 10 comments
Closed

Comments

@liucc52
Copy link

liucc52 commented Nov 14, 2018

sonar scan can't finish when it found can't find resources

our sonar scan stucked when it reports lots of warn
can not find resources for '#include< QDir >'
can not find resources for '#include< QRecF >'

@liucc52 liucc52 changed the title sonar scan can't finish when it found can't find resources sonar CXX plugin sonar scan can't finish when it found can't find resources Nov 14, 2018
@guwirth
Copy link
Collaborator

guwirth commented Nov 14, 2018

Hi,
which version of SQ and cxx plugin are you using?
Please provide LOG file (at least relevant parts).
Regards,

@liucc52
Copy link
Author

liucc52 commented Nov 14, 2018

we are using sonarqube 7.3 cxx plugin 1.2
right now we find if our code have xx< xx::xxx >
the cxx plugin end in a deadlock

"main" #1 prio=5 os_prio=0 tid=0x0000000002669000 nid=0x4cb0 runnable [0x000000000286d000] java.lang.Thread.State: RUNNABLE at java.util.LinkedList.toArray(LinkedList.java:1052) at java.util.ArrayList.(ArrayList.java:177) at org.sonar.cxx.preprocessor.CxxPreprocessor.handleIdentifiersAndKeywords(CxxPreprocessor.java:766) at org.sonar.cxx.preprocessor.CxxPreprocessor.process(CxxPreprocessor.java:482) at com.sonar.sslr.impl.Lexer.preprocess(Lexer.java:153) at com.sonar.sslr.impl.Lexer.preprocess(Lexer.java:143) at com.sonar.sslr.impl.Lexer.lex(Lexer.java:132) at com.sonar.sslr.impl.Lexer.lex(Lexer.java:110) at org.sonar.cxx.preprocessor.CxxPreprocessor.expandMacro(CxxPreprocessor.java:851) at org.sonar.cxx.preprocessor.CxxPreprocessor.handleIdentifiersAndKeywords(CxxPreprocessor.java:747) at org.sonar.cxx.preprocessor.CxxPreprocessor.process(CxxPreprocessor.java:482)

@guwirth
Copy link
Collaborator

guwirth commented Nov 14, 2018

@liucc52 can you provide the source code creating this issue please.

@liucc52
Copy link
Author

liucc52 commented Nov 14, 2018

the code contains template like this
Circle< vc::point >
if we remove < vc::point >, the scan would be ok

@guwirth
Copy link
Collaborator

guwirth commented Nov 14, 2018

@liucc52 maybe duplicate of this #1383?

@liucc52
Copy link
Author

liucc52 commented Nov 14, 2018

yes, i think it is the same issue with #1383, is this issue resolved?

@liucc52
Copy link
Author

liucc52 commented Nov 15, 2018

we found this is a bug of sslr, the thread dump show the main thread hang at
java.lang.Thread.State: RUNNABLE
at org.sonar.sslr.internal.vm.Machine.execute(Machine.java:162)
at org.sonar.sslr.internal.vm.Machine.execute(Machine.java:105)
at org.sonar.sslr.internal.vm.Machine.parse(Machine.java:61)
at com.sonar.sslr.impl.Parser.parse(Parser.java:84)
at com.sonar.sslr.impl.Parser.parse(Parser.java:69)
at org.sonar.squidbridge.AstScanner.scanFiles(AstScanner.java:94)
at org.sonar.cxx.sensors.squid.CxxSquidSensor.execute(CxxSquidSensor.java:156)
at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:177)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:291)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:286)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:264)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
- locked <0x00000007022abca8> (a org.sonar.batch.bootstrapper.Batch)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)

@liucc52
Copy link
Author

liucc52 commented Nov 16, 2018

we resolve this problem by add sonar.cxx.defines=< <,> > to sonar-project.properties

@guwirth
Copy link
Collaborator

guwirth commented Nov 16, 2018

@liucc52 thx for your workaround. What exactly did you do? Replacing < with BLANK<, ...? Question is what happens with shift operators >>?

@guwirth
Copy link
Collaborator

guwirth commented Feb 9, 2019

see #1685

@guwirth guwirth closed this as completed Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants