Skip to content

Jetbrains Gateway cannot connect after 3.5h IDLE period - #148

Closed
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:fix-cannot-connect-when-idle
Closed

Jetbrains Gateway cannot connect after 3.5h IDLE period#148
vrubezhny wants to merge 1 commit into
redhat-developer:mainfrom
vrubezhny:fix-cannot-connect-when-idle

Conversation

@vrubezhny

@vrubezhny vrubezhny commented Aug 1, 2025

Copy link
Copy Markdown
Collaborator

When the DevSpaces WS isn't started or ready, this PR starts the WS and waits for its readiness before starting the Remote IDE Client:

cold-start_spedup.mp4

In some cases the Remote IDE Server cannot correctly process requests (status/stop) - usually when this happens we have no other option to recover, but the full DevSpaces Pod restart. so. with this PR, the User is asked to restart and if agreed, the DevSpaces Pod gets terminated and then restarted, which in its turn makes the Remote IDE server to correctly start:

remote-ide-not-responsive_spedup.mp4

Fixes eclipse-che/che#23485

@vrubezhny
vrubezhny requested a review from azatsarynnyy as a code owner August 1, 2025 15:11
@vrubezhny
vrubezhny requested review from adietish and azatsarynnyy and removed request for azatsarynnyy August 1, 2025 15:11
@codecov-commenter

codecov-commenter commented Aug 1, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 163 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (71098f6) to head (58a72b8).
⚠️ Report is 308 commits behind head on main.

Files with missing lines Patch % Lines
...com/redhat/devtools/gateway/DevSpacesConnection.kt 0.00% 93 Missing ⚠️
...redhat/devtools/gateway/openshift/DevWorkspaces.kt 0.00% 28 Missing ⚠️
...t/devtools/gateway/server/RemoteIDEServerStatus.kt 0.00% 13 Missing ⚠️
.../redhat/devtools/gateway/server/RemoteIDEServer.kt 0.00% 12 Missing ⚠️
...at/devtools/gateway/DevSpacesConnectionProvider.kt 0.00% 9 Missing ⚠️
.../redhat/devtools/gateway/openshift/DevWorkspace.kt 0.00% 8 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main    #148    +/-   ##
======================================
  Coverage   0.00%   0.00%            
======================================
  Files          4      25    +21     
  Lines         26    1008   +982     
  Branches       0     157   +157     
======================================
- Misses        26    1008   +982     

☔ View full report in Codecov by Sentry.
📢 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.

@vrubezhny
vrubezhny force-pushed the fix-cannot-connect-when-idle branch 2 times, most recently from 86b4d42 to 7dd1828 Compare August 2, 2025 10:17

@azatsarynnyy azatsarynnyy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run the plugin from vrubezhny:fix-cannot-connect-when-idle,
and I noticed the UI differs from what is shows on the screenscasts

Image

@vrubezhny do you think I missed some steps?

@azatsarynnyy azatsarynnyy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adietish could you please verify if the PR fixes the original issue you reported

Fixes eclipse-che/che#23485

Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
@adietish
adietish force-pushed the fix-cannot-connect-when-idle branch from 7dd1828 to 58a72b8 Compare August 19, 2025 15:01

@adietish adietish left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't verify that it really helps. Nevertheless, this feels like an improvements. I'd merge it and I'll keep trying to reproduce the issue

onDevWorkspaceStopped: () -> Unit,
onDisconnected: () -> Unit
) {
try {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking: I'd create separate methods for all 3 closing operations (closeForwarder(), stopDevWorkspace(), invokeOnDisconnected) and call them here.

false
)

val forwarder = Pods(devSpacesContext.client).forward(remoteIdeServer.pod, 5990, 5990)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#forward can fail, too ex. if local port is already bound.

.startNewClient(
Lifetime.Eternal,
URI(remoteIdeServerStatus.joinLink),
URI(remoteIdeServerStatus.joinLink!!),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw situations where the joinLink was null. I believe that it would be better to check the joinLink for being non-empty and throw instead of asserting it to be non-null (!!)

@vrubezhny vrubezhny closed this Nov 19, 2025
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.

Jetbrains Gateway cannot reconnect after client disconnects (idl'ing, network change, etc.)

4 participants