Skip to content

Fix thin client connection error during slow download - #366

Open
msivasubramaniaan wants to merge 2 commits into
redhat-developer:mainfrom
msivasubramaniaan:fix-thin-client-slow-download-connection
Open

Fix thin client connection error during slow download#366
msivasubramaniaan wants to merge 2 commits into
redhat-developer:mainfrom
msivasubramaniaan:fix-thin-client-slow-download-connection

Conversation

@msivasubramaniaan

@msivasubramaniaan msivasubramaniaan commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

fixes https://redhat.atlassian.net/browse/CRW-11670

Fixed a premature JetBrains Client connection failure during client binary download on slow network connections.

The connection wait now checks thinClient.clientPresent before considering a presence change as a successful client startup. This prevents intermediate presence changes during the download process from triggering Connection Error / Cannot launch client popups. Also added a check for the case where the client is already present before the presence listener is registered.

Additionally resolved the warnings of the file

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 7351ee4c-af67-4ec9-9cee-01df9ef7b886


Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Aug 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 57.89474% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.87%. Comparing base (71098f6) to head (0b30e10).
⚠️ Report is 424 commits behind head on main.

Files with missing lines Patch % Lines
...com/redhat/devtools/gateway/DevSpacesConnection.kt 61.11% 7 Missing ⚠️
...at/devtools/gateway/DevSpacesConnectionProvider.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            main     #366       +/-   ##
==========================================
+ Coverage   0.00%   38.87%   +38.87%     
==========================================
  Files          4      121      +117     
  Lines         26     5291     +5265     
  Branches       0     1016     +1016     
==========================================
+ Hits           0     2057     +2057     
- Misses        26     2948     +2922     
- Partials       0      286      +286     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@adietish

Copy link
Copy Markdown
Collaborator

@msivasubramaniaan can you please add (CRW-11670) to the commit message (ex. "Fix thin client connection error during slow download (CRW-11670)")? That helps to identify the jira issue when looking at the commits. Thanks

@adietish
adietish force-pushed the fix-thin-client-slow-download-connection branch 4 times, most recently from e70a93b to 4a29fb1 Compare August 31, 2026 22:54
@adietish

adietish commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

@msivasubramaniaan: Your fix is solid. It looks to me though as if the issue still happens: Playing around with it while clearing the client cache, made me hit the issue. Investigating.

msivasubramaniaan and others added 2 commits September 1, 2026 15:59
Signed-off-by: msivasubramaniaan <msivasub@redhat.com>
A transient present→absent→present no longer exits:
The loop keeps polling until clientPresent == true && connectFailed == false hold simultaneously.

Replaced the latched connectWaitDone flag with a connectFailed flag that
signals permanent failure (clientClosed / clientFailedToOpenProject).

Rewrote waitForThinClientConnect to poll clientPresent directly inside a
withTimeout loop, removing the redundant onClientPresenceChanged listener.
The new loop tolerates transient absence flaps while failing fast on
permanent close and still timing out after 60s.

added unit tests for DevSpacesConnection connect/teardown logic (crw-11670)
- waitForThinClientConnect: happy path, timeout, transient flap, connectFailed
- onThinClientClosed: teardown when live vs no-op when not live
- Expose CONNECT_TIMEOUT and timeoutMs param for test injection

Signed-off-by: adietish <adietish@redhat.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@adietish
adietish force-pushed the fix-thin-client-slow-download-connection branch from 4a29fb1 to 0b30e10 Compare September 1, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants