SSE event stream leaks HTTP pool connections when the proxy gzips responses; sync hangs forever

Not the same as SLI-1229 or SLI-2080: the server is reachable and sync works for the first ~15 minutes.

Please provide

  • Operating system: Windows 11 Pro (10.0.26200)
  • SonarQube for IntelliJ plugin version: 12.9.0.85269 (bundled sloop / sonarlint-core 11.10.0.86299, httpclient5 5.6.4)
  • IntelliJ version: JetBrains Rider 2026.2 (IntelliJ Platform)
  • Programming language you’re coding in: C# (also TypeScript/JavaScript)
  • Is connected mode used: Yes
    • SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?): SonarQube Community Build 25.8.0.112029, behind an Apache reverse proxy with mod_deflate enabled

And a thorough description of the problem / question:
Symptom After about 15 minutes, “SonarQube: Synchronizing projects…” never finishes. In thread dumps, SonarLint Local Storage Synchronizer, Smart Notifications Polling and Show Issue or Hotspot Request Handler are all blocked in ServerApiHelper.processResponse → CompletableFuture.join for hours. Only a backend restart recovers it.

Root cause

  1. ApacheHttpClientAdapter.getEventStream sets a per-request config built with RequestConfig.custom(). That replaces the default config from HttpClientProvider.buildRequestConfig, which has setContentCompressionEnabled(false). A fresh RequestConfig.Builder defaults compression to true, so the SSE request is sent with Accept-Encoding: gzip, deflate.
  2. The proxy gzip-compresses the text/event-stream response and buffers it, so the \r\n heartbeats never reach the client. Tested with curl against api/push/sonarlint_events:
    • without Accept-Encoding: a heartbeat arrives about every 20 s;
    • with Accept-Encoding: gzip: 0 bytes in 200 s.
  3. EventStream arms a 180 s watchdog in onConnected(), and only received data cancels it. When it fires, it calls connect(wsPath), which overwrites currentRequest without cancelling the previous request.
  4. The SSE request uses setResponseTimeout(Timeout.ZERO_MILLISECONDS), so the abandoned exchange keeps its pooled connection forever.
  5. One connection leaks every 180 s. After 5 (the default max per route) the pool is exhausted, and every other request waits for a lease indefinitely. httpcore5’s StrictConnPool only checks lease deadlines when the pool sees activity, so connectionRequestTimeout, and the -Dsonarlint.http.* properties, don’t unblock it.

Heap histogram of the hung backend: 6 live ApacheHttpClientAdapter$1 (SSE consumers) but only 1 HttpAsyncRequest, 5 PoolEntry, and 4 pending StrictConnPool$LeaseRequest.

Suggested fixes (any one solves it; 1 and 2 together are best)

  1. In getEventStream, call .setContentCompressionEnabled(false) on the per-request config, or derive it from the default config instead of RequestConfig.custom(). Compression is never wanted for SSE.
  2. In EventStream, cancel or close the current request before reconnecting from the watchdog: Optional.ofNullable(currentRequest.getAndSet(null)).ifPresent(AsyncRequest::cancel) at the start of connect(...).
  3. Optionally, give the SSE request a finite socket/response timeout longer than the heartbeat period (for example 2–3 minutes) instead of ZERO.

Workaround verified Patching getEventStream to add setContentCompressionEnabled(false) in sonarlint-http-11.10.0.86299.jar fixed it: the backend holds 1–2 connections and sync completes. (stable for 41 minutes)

Hello @vassilis-brachos-ed, thank you for reaching out.

I think the issue you described is valid. We will provide a fix in our next version!