Plugin should give up if server is not available

  • SonarQube for IntelliJ plugin version: 10.15
  • using private SonarQube Server

And a thorough description of the problem / question:
Our server is behind a VPN. Some days I don’t connect to the VPN right away and the plugin stacks up dozens of threads trying to connect. This makes it difficult to see other background tasks, etc. The plugin should give up after a short period of time and optionally report that the server is not reachable instead of wasting resources trying to do something that will never succeed.

Hello @efenderbosch,

Thanks for taking the time to share your feedback. Your suggestion is already something we have in mind and that is tracked here. I will discuss with the team how to prioritize it.

I’m a bit surprised with the “dozens of threads” you mentioned, how does that materialize? Are this “threads” disappearing at some point? Normally the requests to the server should timeout at some point, and shouldn’t stay forever. We might have something else to fix here, and any detail helping us to understand your case would greatly help

Say I use my IDE’s refactoring. Changing a function name or public constant could impact several files. Now I’ve got a stack of “Running SonarQube for IDE Analysis for …” down in my IDE’s status area. They seem to take several minutes to clear.

And here’s a redacted stacktrace.

 [2025-02-04T09:14:19.276] [SonarLint Local Storage Synchronizer] ERROR sonarlint - Error running task 'Synchronizing projects...'
java.util.concurrent.CompletionException: org.apache.hc.client5.http.ConnectTimeoutException: Connect to https://sonar.example.com:443 [sonar.example.com/10.202.38.189, sonar.example.com/10.202.42.148, sonar.example.com/10.202.40.226] failed: Connection timed out
	at java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:413)
	at java.base/java.util.concurrent.CompletableFuture.join(CompletableFuture.java:2118)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processResponse(ServerApiHelper.java:110)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.rawGet(ServerApiHelper.java:95)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.get(ServerApiHelper.java:72)
	at org.sonarsource.sonarlint.core.serverapi.system.SystemApi.lambda$getStatus$0(SystemApi.java:38)
	at org.sonarsource.sonarlint.core.serverapi.ServerApiHelper.processTimed(ServerApiHelper.java:243)
	at org.sonarsource.sonarlint.core.serverapi.system.SystemApi.getStatus(SystemApi.java:37)
	at org.sonarsource.sonarlint.core.ServerApiProvider.checkIfBearerIsSupported(ServerApiProvider.java:92)
	at org.sonarsource.sonarlint.core.ServerApiProvider.getServerApi(ServerApiProvider.java:81)
	at org.sonarsource.sonarlint.core.sync.SynchronizationService.synchronizeProjectsOfTheSameConnection(SynchronizationService.java:181)
	at org.sonarsource.sonarlint.core.sync.SynchronizationService.lambda$synchronizeProjectsSync$3(SynchronizationService.java:165)
	at org.sonarsource.sonarlint.core.progress.TaskManager.startTask(TaskManager.java:61)
	at org.sonarsource.sonarlint.core.progress.TaskManager.startTask(TaskManager.java:44)
	at org.sonarsource.sonarlint.core.sync.SynchronizationService.synchronizeProjectsSync(SynchronizationService.java:157)
	at org.sonarsource.sonarlint.core.sync.SynchronizationService.lambda$synchronizeProjectsAsync$2(SynchronizationService.java:150)
	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.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	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)
Caused by: org.apache.hc.client5.http.ConnectTimeoutException: Connect to https://sonar.example.com:443 [sonar.example.com/10.202.38.189, sonar.example.com/10.202.42.148, sonar.example.com/10.202.40.226] failed: Connection timed out
	at org.apache.hc.client5.http.ConnectExceptionSupport.createConnectTimeoutException(ConnectExceptionSupport.java:52)
	at org.apache.hc.client5.http.ConnectExceptionSupport.enhance(ConnectExceptionSupport.java:74)
	at org.apache.hc.client5.http.impl.nio.MultihomeIOSessionRequester$2$1.failed(MultihomeIOSessionRequester.java:161)
	at org.apache.hc.core5.concurrent.BasicFuture.failed(BasicFuture.java:138)
	at org.apache.hc.core5.reactor.IOSessionRequest.failed(IOSessionRequest.java:78)
	at org.apache.hc.core5.reactor.InternalConnectChannel.onException(InternalConnectChannel.java:99)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:55)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.processEvents(SingleCoreIOReactor.java:178)
	at org.apache.hc.core5.reactor.SingleCoreIOReactor.doExecute(SingleCoreIOReactor.java:127)
	at org.apache.hc.core5.reactor.AbstractSingleCoreIOReactor.execute(AbstractSingleCoreIOReactor.java:86)
	at org.apache.hc.core5.reactor.IOReactorWorker.run(IOReactorWorker.java:44)
	... 1 more
Caused by: java.net.ConnectException: Connection timed out
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:682)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:973)
	at org.apache.hc.core5.reactor.InternalConnectChannel.onIOEvent(InternalConnectChannel.java:64)
	at org.apache.hc.core5.reactor.InternalChannel.handleIOEvent(InternalChannel.java:51)
	... 5 more

Even after those exceptions have been thrown and logged, the status area notifications are still present several minutes later.

I think the stacktrace you sent is not related to the status bar tasks hanging, there is probably something else going on. At least I was not able to reproduce the problem on my side.

Could you please enable verbose logging and share the traces here?