Sonar Scanner Failed to close server

Dear Support/Community,

I’m analyzing an angular monorepo (typescript) during a jenkins pipeline. I noticed the issue (warning) mentioned below and I can’t recall having this one before. It might also relate to the upgrade to Angular 9/Typescript 3.8.3, but the exception trace concludes otherwise. I cannot exclude the possibility that the non closable server connection comes from some typescript/SonarJS scan itself.

It must be said that the analyses as well as the upload of the results to our sonar server instance (on-premise) of the project (all modules) are successfull. It only seems that the sonar scanner has problems closing the connection to the server.

Versions in use:
SonarQube 8.2
Scanner: 4.2.0.1873
Jenkins SonarQube Scanner: 2.11
Jenkins Sonar Quality Gates Plugin: 1.3.1
Java: 11.0.5 AdoptOpenJDK
OS: Windows Server 2016

If there is a similar issue, I apologize for not finding it. Maybe you can point me into the right direction :wink:

Steps to reproduce: None that I know of unfortunately besides the setup


Call of Sonar Scanner:
sonar-scanner -Dsonar.branch.name=“my branch Name” -Dproject.settings=/libs/ui-layout/sonar-project.properties -Dsonar.javascript.node.maxspace=2048
Error stack

09:50:36  INFO: Analysis report generated in 142ms, dir size=159 KB
09:50:36  INFO: Analysis report compressed in 77ms, zip size=42 KB
09:50:37  INFO: Analysis report uploaded in 33ms
09:50:37  INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarqube.*********
09:50:37  INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
09:50:37  INFO: More about the report processing at https://sonarqube.*****/api/ce/task?id=AXUmFujKYP1pakYm-MOh
09:50:39  WARN: Failed to close server
09:50:39  java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:53079
09:50:39  	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:249)
09:50:39  	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:167)
09:50:39  	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
09:50:39  	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
09:50:39  	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
09:50:39  	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
09:50:39  	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
09:50:39  	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
09:50:39  	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
09:50:39  	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
09:50:39  	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:264)
09:50:39  	at okhttp3.RealCall.execute(RealCall.java:93)
09:50:39  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.request(EslintBridgeServerImpl.java:195)
09:50:39  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.clean(EslintBridgeServerImpl.java:283)
09:50:39  	at org.sonar.plugins.javascript.eslint.EslintBridgeServerImpl.stop(EslintBridgeServerImpl.java:308)
09:50:39  	at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.stop(StartableCloseableSafeLifecyleStrategy.java:52)
09:50:39  	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.stop(AbstractInjectionFactory.java:88)
09:50:39  	at org.picocontainer.behaviors.AbstractBehavior.stop(AbstractBehavior.java:179)
09:50:39  	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.stop(Stored.java:141)
09:50:39  	at org.picocontainer.behaviors.Stored.stop(Stored.java:118)
09:50:39  	at org.picocontainer.DefaultPicoContainer.stopAdapters(DefaultPicoContainer.java:1048)
09:50:39  	at org.picocontainer.DefaultPicoContainer.stop(DefaultPicoContainer.java:803)
09:50:39  	at org.sonar.core.platform.ComponentContainer.stopComponents(ComponentContainer.java:165)
09:50:39  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:124)
09:50:39  	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
09:50:39  	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
09:50:39  	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
09:50:39  	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
09:50:39  	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
09:50:39  	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
09:50:39  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
09:50:39  	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
09:50:39  	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
09:50:39  	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
09:50:39  	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
09:50:39  	at com.sun.proxy.$Proxy0.execute(Unknown Source)
09:50:39  	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
09:50:39  	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
09:50:39  	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
09:50:39  	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
09:50:39  	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
09:50:39  Caused by: java.net.ConnectException: Connection refused: connect
09:50:39  	at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method)
09:50:39  	at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107)
09:50:39  	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
09:50:39  	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
09:50:39  	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
09:50:39  	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
09:50:39  	at java.base/java.net.Socket.connect(Socket.java:609)
09:50:39  	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:130)
09:50:39  	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
09:50:39  	... 46 common frames omitted
09:50:39  
09:50:51  INFO: Analysis total time: 1:10.647 s
09:50:51  INFO: ------------------------------------------------------------------------
09:50:51  INFO: EXECUTION SUCCESS
09:50:51  INFO: ------------------------------------------------------------------------
09:50:51  INFO: Total time: 1:11.530s
09:50:51  INFO: Final Memory: 23M/94M
09:50:51  INFO: ------------------------------------------------------------------------
[Pipeline] }
09:50:51  Deleting 1 temporary files
[Pipeline] // nodejs
[Pipeline] }
[Pipeline] // withSonarQubeEnv
[Pipeline] waitForQualityGate
09:50:54  Checking status of SonarQube task 'AXUmFujKYP1pakYm-MOh' on server 'SonarQube'
09:50:54  SonarQube task 'AXUmFujKYP1pakYm-MOh' status is 'SUCCESS'
09:50:54  SonarQube task 'AXUmFujKYP1pakYm-MOh' completed. Quality gate is 'OK' 
09:50:54  QualityGate.status returned from SonarQube for ui-layout: OK
09:50:54  currentBuild.result was set to: SUCCESS

Do you know of this issue? Do you have any suggestions why and how to solve this? Am I even be able to influence the behaviour somehow?

I’m planning to upgrade all the components (except Java) in the next weeks. If this solves this issue I will update my post.

Best regards
Benjamin

Hi Benjamin,

Welcome to the community!

The error you see happens after the analysis report is submitted to the server. I.E. analysis is done at that point, and some other process is taking over. You (very helpfully!) list that you’re using the Jenkins Sonar Quality Gates Plugin. Since that’s something that would happen after analysis, and since it’s not something we support (it’s not ours) could you start by uninstalling it and trying agian?

 
Ann