[Eclipse SonarLint] Excessive connections to SonarQube server

Hi,

I’m using Eclipse 2020-12 (4.18.0) and SonarLint for Eclipse 5.6.0.25634. The workspace projects are bound to a local SonarQube server. On IDE start the SonarLint plugin will spawn excessive connections to the SonarQube server:

cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=
cntlm[24433]: 127.0.0.1 GET http://sonar:9000/api/developers/search_events?projects=&from=

These connections remain open, so further attempts fail:

cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)
cntlm[24433]: Connection failed for sonar:9000 (Too many open files)

In the next step, this will block network access of the machine:

cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.
cntlm[24433]: Proxy connect failed, will try proxy.company:8080
cntlm[24433]: No proxy on the list works. You lose.

cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files
cntlm[24433]: Serious error during accept: Too many open files

The SonarLint plugin should close its connections properly, and maybe initiate not that many, because the response to above GET is always {"errors":[{"msg":"Unknown url : /api/developers/search_events"}]}.

Hi @bben

Thanks for reporting the issue.

The SonarLint plugin should […] maybe initiate not that many [connections], because the response to above GET is always {"errors":[{"msg":"Unknown url : /api/developers/search_events"}]} .

Can you please provide a few additional details:

  • what is the version and edition of your SonarQube server? I guess it is a community edition, based on the response from api/developers/search_events
  • can you enable verbose logs in the SonarLint Console in Eclipse, and look at what happens shortly after Eclipse startup. You should see a single HTTP call to http://sonar:9000/api/developers/search_events?projects=&from=, that should return a 404 HTTP code.

    Then SonarLint should no more attempt to call http://sonar:9000/api/developers/search_events?projects=&from=, except if you later change some project bindings, or restart your IDE.

The SonarLint plugin should close its connections properly

Regarding the connection “leak”, we are investigating, and we will keep you posted.

Hi @Julien_HENRY,

you guessed right. We are using Community Edition Version 7.9.1 (build 27448).

The verbose startup log in the SonarLint Console shows following output:

Starting SonarLint for Eclipse 5.6.0.25634
Starting SonarLint engine for connection 'sonar'...
Create : /home/ben/.sonarlint/plugins
Plugin cache: /home/ben/.sonarlint/plugins
Create : /home/ben/.sonarlint/plugins/_tmp
Load plugins
Load plugins (done) | time=59ms
Plugins:
  * SonarScala 1.5.0.315 (sonarscala)
  * SonarPython 1.14.1.3143 (python)
  * SonarJava 5.13.1.18282 (java)
  * SonarHTML 3.1.0.1615 (web)
  * SonarXML 2.0.1.2020 (xml)
  * SonarKotlin 1.5.0.315 (kotlin)
  * SonarPHP 3.2.0.4868 (php)
  * SonarJS 5.2.1.7778 (javascript)
  * SonarRuby 1.5.0.315 (ruby)
Using storage for server 'sonar' (last update 11.11.20, 16:45)
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=142ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=40ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=43ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=93ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=40ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=54ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=46ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=48ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=33ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=50ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=46ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=62ms
Trigger: STARTUP
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=50ms
Clear markers on 0 excluded files
SonarLint processing file /company.server/src/company/server/Context.java...
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=34ms
Binary directory '/javax.mail/bin' was not added because it was not found. Maybe you should enable auto build of your project.
Binary directory '/org.jgrapht/bin' was not added because it was not found. Maybe you should enable auto build of your project.
Binary directory '/net.fortuna.ical4j/bin' was not added because it was not found. Maybe you should enable auto build of your project.
Connected mode (using configuration of 'company.product' in connection 'sonar')
Starting analysis with configuration:
[
  projectKey: company.product
  (...)
]
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=63ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=79ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=78ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=72ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=41ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=35ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=52ms
Start analysis
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=69ms
(...)
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=47ms
GET 200 http://sonar:9000/api/qualityprofiles/search.protobuf | response time=29ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=35ms
Downloaded quality profiles in 97ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=43ms
Check for binding data updates on 'sonar' for project 'company.product'
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=56ms
GET 200 http://sonar:9000/api/settings/values.protobuf | response time=50ms
Downloaded settings in 51ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=30ms
GET 200 http://sonar:9000/api/qualityprofiles/search.protobuf?project=company.product | response time=28ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=36ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=31ms
Downloaded project quality profiles in 74ms
GET 200 http://sonar:9000/api/settings/values.protobuf?component=company.product | response time=21ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=32ms
Downloaded settings in 67ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=45ms
GET 200 http://sonar:9000/api/components/tree.protobuf?qualifiers=BRC&component=company.product&ps=500&p=1 | response time=21ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=39ms
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=39ms
(...)
GET 404 http://sonar:9000/api/developers/search_events?projects=&from= | response time=53ms
GET 502 http://sonar:9000/api/developers/search_events?projects=&from= | response time=11ms
Download server issues for /company.server/src/company/server/Context.java
GET 502 http://sonar:9000/api/developers/search_events?projects=&from= | response time=4ms
GET 502 http://sonar:9000/api/developers/search_events?projects=&from= | response time=5ms

Thanks for keeping me posted.

So there are two problems IMO:

  • first one is that we are not using connection pooling correctly. This problem has been there for ever, but was probably not too annoying, since there is a timeout, and unused connections are closed after a while. Still this is inefficient. I created a ticket, but this will be a consequent work to fix:
    https://jira.sonarsource.com/browse/SLE-411
  • the second one is a change of behavior in the recent versions of SonarLint Eclipse, that lead to call api/developers/search_events multiple times in a row at startup (once per bound project). Combined with the previous issue, I guess this is what is causing the Too many open files. I created another ticket, since this particular issue might be easier to fix, and could allow to mitigate the overall connection pool problem until we properly fix it.
    https://jira.sonarsource.com/browse/SLE-410

I suggest you watch for the tickets to be notified of the progress.

Thanks again for the very clear report!

1 Like

Will do. Thank you, too!

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