Sonarlint fail to run with PDT (8.2) installed

Please provide

  • Operating system:
    *Ubuntu 20.04
  • SonarLint plugin version:
  • SonarSource SonarLint for Eclipse 10.3.0.82013
  • Programming language you’re coding in:
  • C/ C++ , python, PHP, typescript
  • Is connected mode used:
    • Connected to SonarQube : 10.4.1.88267

And a thorough description of the problem / question:
After updating sonal lint from version 9.x to 10.3 sonarlint does not work and give errors.
The problem is due to PDT (PHP plugin) is installed in eclipse.
After uninstalling PDT sonalint start working well.
After re-installing PDT soanar lint fail again.

We use Eclipse CDT with installed pydev, pdt and wild Web Develop.

Error log at eclipse starting

Rule typescript:S6252 is enabled on the server, but not available in SonarLint

Rule typescript:S5042 is enabled on the server, but not available in SonarLint

Rule tssecurity:S3649 is enabled on the server, but not available in SonarLint

Computing file exclusion for uri ‘file:/home/afardin/git/EMS-UWP4/userapps/gavazzi/apps/cmt/src/cmt.c’

Unable to find client file for uri file:/home/afardin/git/EMS-UWP4/userapps/gavazzi/apps/cmt/src/cmt.c

Error during execution of SonarLint analysis

Error during execution of SonarLint analysis

java.lang.IllegalStateException: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.

at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:317)

at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:165)

at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarJob.run(AbstractSonarJob.java:37)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Caused by: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.

at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)

at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)

at org.sonarlint.eclipse.core.internal.utils.JobUtils.waitForFutureInJob(JobUtils.java:74)

at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:303)

… 3 more

Caused by: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.

at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220)

at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204)

at org.sonarsource.sonarlint.core.rpc.protocol.SingleThreadedMessageConsumer.lambda$new$0(SingleThreadedMessageConsumer.java:51)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)

at java.base/java.lang.Thread.run(Thread.java:1583)

java.lang.IllegalStateException: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.

at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:317)

at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.doRun(AnalyzeProjectJob.java:165)

at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarJob.run(AbstractSonarJob.java:37)

at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Caused by: java.util.concurrent.ExecutionException: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.

at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)

at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)

at org.sonarlint.eclipse.core.internal.utils.JobUtils.waitForFutureInJob(JobUtils.java:74)

at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob.run(AnalyzeProjectJob.java:303)

… 3 more

Caused by: org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error.

at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:220)

at org.sonarsource.sonarlint.shaded.org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:204)

at org.sonarsource.sonarlint.core.rpc.protocol.SingleThreadedMessageConsumer.lambda$new$0(SingleThreadedMessageConsumer.java:51)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)

at java.base/java.lang.Thread.run(Thread.java:1583)

GET 200 http://192.168.2.226:9000/api/developers/search_events?projects=EMS-Core&from=2024-07-03T15%3A04%3A26%2B0200 | response time=9ms

Storing last event polling in /home/afardin/Progetti/cgc_uwp_workspace/.sonarlint/storage/4347435f534f4e41525f51554245/projects/454d532d436f7265/last_event_polling.pb

GET 200 http://192.168.2.226:9000/api/developers/search_events?projects=EMS-Core&from=2024-07-03T15%3A05%3A26%2B0200 | response time=9ms

Hi @alef75,

thanks for reaching out. Sadly I cannot reproduce the issue, would you be so kind to provide me with the full logs?

Can you also please open the Problems view and Error Log view? I’ve encountered PDT starting the debugger sometimes on ports interfering with different Eclipse plug-ins, not necessarily Eclipse, but this might be a possibility for the error origin.
If there are any errors that look related, please provide them to me as well.

Best,
Tobias

for sure:
here the log
sonarlint_error.log (6.8 KB)

Thanks, @alef75, for the logs. Quick question before I start investigating: Does this issue only happen when analyzing C/C++ files?
There is a CDT error in the logs, and it is a bit confusing to see it there. And that the SonarLint error stack traces are pretty short.

Can you also restart the IDE once and then trigger an analysis and provide me with the whole logs from the beginning? So I have everything from startup until after this issue, please.

I will test with an Eclipse installation featuring CDT, PDT, PyDev and WWD. And then come back to you.

Best,
Tobias

Hi Tobias
thank you very much

I confirm that the problem is here also analyzing the other languages

here you are the logs from the beginning (after restarting)
sonarlintError.log (5.5 MB)

Hi Tobias, I’ve made some more tests.
I’ve found that the problem is caused by some files in our project, but I don’t fins which one.

With our full project and with PDT:
sonarlint 9.x Works
sonarlint 10.3 Does Not Works

With our full project and without PDT:
sonarlint 9.x Works
sonarlint 10.3 Works

With our stripped down project and with PDT:
sonarlint 9.x Works
sonarlint 10.3 Works

I’ve also noticed that sonarlint 9.x behave very differntly from behave 10.3:
sonarlint 10.3, if I close and re-open the project takes about 20 minutes parsing every file of our project, included all the excluded files.

for example sonar 10.3 parse alla file included the folder TestAcceptance/pyvenv/ that contain all the python virtual environment, the target/ folder that contain all build artifact and
html/weapp/node_modules/, that contains all the node_moduled libraryes for the webapp.

Our project is in a monorepo, it is composed by:

Project/
userapps/
3rdParty/
public/
gavazzi/ → (C/C++ code we want analize with sonar)

target/ → (files generated by the build and generated target root file system)

html/
weapp/
src/
node_modules/

TestAcceptance/
Feature/
pyvenv/

Hi @alef75,

Thanks for the insight. I’ve created THIS ticket to be tackled by the next release, which is planned for the end of July.

The issue can be because your project is really big or the environment is very tightly configured, and our indexing got slower and slower over time. Additionally, some plug-ins we relied on (e.g. for Maven) degraded in performance as well so this adds up.
The main reason here seems to be the indexing is not fully done at the moment the analysis starts.

With this ticket I plan to speed it up, would it be okay for you if I would ping you before the release with a dogfooding version of SonarLint for Eclipse to test and see if and how much the performance increased?

Best,
Tobias

Hi Tobias,

Thank you for the feedback, I would be appy to help in testing it.

I hope there wil be a way to exclude some part of the project from sonarlint parse.
Why not using the exclude directive directly for this poupose ?
I know other eclipse plugin have similar issues.
I also know that eclipse have the “derived resource” concept, and we use it to exclude the paths from git, serach and so on, (we use the plugin autoderiv for applying it automatucally).

For now I’m switching back to sonarlint 9.x

Regards
Alessandro

Hi @alef75,

thanks for your patience. I just released a new version of SonarLint for Eclipse, but due to the holiday season, me being absent, and noticing that these changes are a bit bigger than anticipated for just a couple of days of hardening, this ticket mentioned above sadly didn’t make it to this release :frowning:

I want to emphasize for transparency that this will be done now for the next release as the ground stone, the specification about what all needs to be done was done in the meantime (you can find the PDF on the ticket if you’re interested in it technically) and a week before the next release was planned to implement it.
Looking at this issue being about the indexing and, therefore, an integral part of SonarLint before the actual analysis, I’d like to make it right and even value the impact it might have (assuming it to be very positive for both memory consumption as well as speed).

I will keep you posted before the next release and offer you an artifact for testing.
As you already rolled back, there is currently nothing expected from you to do :smile:

Best,
Tobias

Hi @alef75,

coming back to you as I just released SonarLint for Eclipse 10.6 available everywhere where you find SonarLint.

Sadly, I didn’t manage to send you an artifact for testing on short notice, but here are some of the performance improvements that should affect you positively. These are following a baby-step approach so it won’t be working like a Swiss army knife:

  • don’t index sub-projects, speeding up importing projects / opening workspace and full project analysis
  • don’t index Python virtual environments, currently only supported at the root of the project
  • don’t index Node.js node_modules directory, currently only supported at the root of the project
  • don’t index output directories like target
  • don’t index version control related directories (like .git)

We currently don’t cover CDT as this will be handled on its own as its documentation is lacking and they don’t have that many options to exclude output directories.
Also, as this might not fully fit you yet (e.g. the node_modules for you is in a sub-directory), a few follow-up tickets are planned including THIS, that should be interesting for you!

I hope that these changes will already improve your performance and overall experience a bit!

Best,
Tobias

Hi Tobias

Thank you for all the great work you have done.

These improvements don’t affect my case, I’ve noticed a slightly improvement, but the problem is still there.
For CDT and eclipse in general I thin that the eclipse “derived resource” concept could be an interesting path to follow.

I think that the more robust and flexible way (for sure will fix my environment) will be to use the current sonarlint file exclusion properties to exclude also sonar indexing, this way I can enumerate all the unwanted folder.

regards
Alessandro

Hi @alef75,

thanks for your feedback, it is very valuable to us :people_hugging:

I honestly haven’t yet discovered the “derived resources” except for having heard the term without knowing what it is. So, thanks for pointing me in that direction!

I’ve added it to the main “CDT performance improvement ticket”. It currently is still an assortments of idea but from what I glimpsed at regarding the derived resources, it looks very promising!

Regarding the other ticket I linked, I agree with you that we should make use of the file exclusions (as this concept already exists). I created a new ticket because I’m not sure yet if this is feasible or not yet with how we integrate the file exclusions but the ultimate goal will be not to have two different options that sound confusingly similar.

Best,
Tobias

Hi Tobias

I need to repoint to the original bug : Sonarlint fail to run with PDT (8.2) installed

sonarlint in connected mode to sonarQube 10.4.1

In my eclipse IDE CDT + PDT with sonarlint 9.x all work right.

In my eclipse IDE CDT with sonarlint 10.x (now 10.6) all work right ,slow index but then sonarlint work and found all issues.

As soon as I install PDT in the eclipse IDE CDT with sonarlint 10.x (now 10.6) sonarlint started giving error and not showing issues.

please find in attachment the logs

(attachments)

sonarlintError.log (218 KB)

Hey @alef75,

sorry for the late response I’m just back from vacation. I will have a look tomorrow and try to check what could cause this - we have no dependency on Eclipse PDT and I’m curious to see what breaks.

When you reported it initially I didn’t find any issue. Have you tried also with the latest SonarLint for Eclipse Dogfooding artifact?
If I cannot reproduce the issue, I will also try to come back and ask for a reproducer.

Best,
Tobias

Hi Tobias

I’ve used the last sonarlint version 10.6.
The log I’ve sent you has the maximum verbosity, so I hope you can find something useful, anyway I would be happy to help you on replicating and getting more logs.

Regards
Alessandro

1 Like

Hi @alef75,

I want to give you a quick heads-up about what I’m doing:

I found two distinct issues in the logs you provided.
I couldn’t reproduce the issue with a small CDT project I have where installing PDT on top of it would break SonarLint, but I have to say the only reason I would see PDT being a game changer here is if they would interfere with the connection of the SonarLint IDE plug-in to the part of SonarLint running out of process. I will investigate further.

Sorry to not have a final answer yet :slightly_frowning_face:

Best,
Tobias

Hi @alef75,

I have a similar thread open at the moment, would you be so kind to follow the latest response for me and provide me with the updated logs and the information about the C/C++ Build as well?

This way I will have at least more logs about this.

Best,
Tobias

Hi Tobias

please find in attachment the error log with sonarlint 10.8.

regarding my information about the C/C++ Build:
I’ve got a lot of build configurations, this the one I’m using for the log I’ve sent.
I hope this could help.
Tell me if you need more from me.

(attachments)

EclipseSonarLint10.8_Error.log (3.8 MB)

Hi @alef75,

thank you very much. I will have a look at the logs and check what is going on there.

Based from the screenshot, is ${ProjDirPath} evaluated to the same location of the project (the project folder where also the .project file and so on are located (which in your case should be /home/afardin/git/EMS based on the logs)?

Our CDT integration should ignore this case and index everything but what happens if you change it just for testing to output into another directory like ${ProjDirPath}/noSonarLintConflictBuild just for testing and restart the IDE. I’m curious about this would change anything as this would mean our integration might be faulty.

Best,
Tobias

Hi Tobias,

your case should be /home/afardin/git/EMS based on the logs)? yes

${ProjDirPath}=/home/afardin/git/EMS

there we have also our main makefile, that build the entire project.
If I change to another path, we can’ build because eclipse will check the makefile there

Anyway I try to change it and see what happens with sonarlint and let you know

regards
Alessandro