Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a workspace is idled for inactivity user is redirected to Che dashboard #20599

Closed
Tracked by #21254 ...
benoitf opened this issue Oct 6, 2021 · 13 comments
Closed
Tracked by #21254 ...
Assignees
Labels
area/gateway engine/devworkspace Issues related to Che configured to use the devworkspace controller as workspace engine. kind/enhancement A feature request - must adhere to the feature request template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.

Comments

@benoitf
Copy link
Contributor

benoitf commented Oct 6, 2021

Is your enhancement related to a problem? Please describe

Let say I'm accessing an endpoint of a workspace at

https://che-eclipse-che.apps.my-cluster.com/workspace<tons-of-digits>/<endpoint-name>/8080

if my workspace is stopped, I will get like a basic 503 error (or another http error)

Describe the solution you'd like

I would like to have a page allowing to be redirected to the dashboard to restart my workspace if the workspace is down

Describe alternatives you've considered

Anything that may be more user friendly for the user if he refresh the editor page on a stopped workspace

Release Notes Text

When a workspace is stopped after an inactivity now the users are redirected to the Dashboard. Previously a 503 error was displayed.

@benoitf benoitf added kind/enhancement A feature request - must adhere to the feature request template. engine/devworkspace Issues related to Che configured to use the devworkspace controller as workspace engine. labels Oct 6, 2021
@che-bot che-bot added the status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. label Oct 6, 2021
@benoitf benoitf added the severity/P2 Has a minor but important impact to the usage or development of the system. label Oct 6, 2021
@l0rd l0rd added area/gateway severity/P1 Has a major impact to usage or development of the system. area/devworkspace-che-operator and removed status/need-triage An issue that needs to be prioritized by the curator responsible for the triage. See https://github. severity/P2 Has a minor but important impact to the usage or development of the system. area/gateway labels Oct 7, 2021
@l0rd l0rd changed the title [devWorkspace] placeholder on the workspace routes when a workspace is not started Error 503 after a workspace is idled for inactivity Mar 4, 2022
@l0rd l0rd mentioned this issue Mar 15, 2022
35 tasks
@ibuziuk ibuziuk mentioned this issue Apr 4, 2022
45 tasks
@ibuziuk ibuziuk mentioned this issue Apr 26, 2022
58 tasks
@dkwon17
Copy link
Contributor

dkwon17 commented May 4, 2022

Hi, I would like to help investigate this issue

@dkwon17 dkwon17 self-assigned this May 4, 2022
@dkwon17
Copy link
Contributor

dkwon17 commented May 5, 2022

Does anyone know how this was implemented for che-server based workspaces?

I don't know how it was implemented before, but an idea I have for this issue is to use the Errors middleware https://doc.traefik.io/traefik/middlewares/http/errorpages/ to redirect requests to the dashboard when there is a 503/504 error code

@sparkoo
Copy link
Member

sparkoo commented May 6, 2022

@dkwon17 I would guess that behavior with che-workspaces was similar to what's reported here. The traefik's errors middleware looks promising.

@dkwon17
Copy link
Contributor

dkwon17 commented May 6, 2022

Thank you @sparkoo , I'll take a deeper look

@benoitf
Copy link
Contributor Author

benoitf commented May 6, 2022

@dkwon17 it was not implemented for che-server workspaces.

Che-Server workspaces were displayed through an iframe of the dashboard.
So URL opened/displayed in the browser was the dashboard URL which was always responding/there.

Now, as we're connected directly to the IDE route without being included in an Iframe this is why it needs to be handled on the routing side.

@dkwon17
Copy link
Contributor

dkwon17 commented May 6, 2022

So far, I was able to get the middleware to sometimes work. I found that it works consistently if I delete the workspace service (screenshot) created in the user namespace after the workspace stops:

image

This seems to be because the request to the service sometimes hangs for a few minutes if there are no pods, which causes traefik to close the request, preventing the errors middleware from firing:
image

If the workspace service doesn't exist when the workspace stops, then the request to the non-existent service quickly results in an error, which the errors middleware can handle.

@dkwon17
Copy link
Contributor

dkwon17 commented May 9, 2022

Hi @amisevsk , when a DW stops, would having the DWO delete the workspace service ({workspaceID}-service) during the DW reconciliation be reasonable?

EDIT:
Maybe we don't need to delete the service. I noticed that if I set my own connection timeout for the service: https://doc.traefik.io/traefik/routing/services/#forwardingtimeouts, then the Errors middleware will kick in after the timeout.

In other words, if I set the timeout to 5s, when an idled workspace is refreshed, we will try to establish a connection to the workspace service for 5s. If we cannot, then the Errors middlware redirects the request to the dashboard.

@amisevsk
Copy link
Contributor

amisevsk commented May 9, 2022

Deleting the service would be controlled by the Che Operator, as it hosts the routing controller for the che routingClass. Che Operator would need to delete resources when it reconciles a DevWorkspaceRouting with the controller.devfile.io/devworkspace-started: "false" annotation.

Currently, DWO will clean up workspace resources (including the DevWorkspaceRouting) if it has the configuration setting config.workspace.cleanupOnStop set to true, and this may become a default behavior in the future.

@dkwon17
Copy link
Contributor

dkwon17 commented May 18, 2022

I have two WIP implementations, at the moment I'm leaning towards implementation 2 since I think it is a bit simpler:

Implementation 1: Change traefik routes when devworkspace is stopped: eclipse-che/che-operator#1386

Implementation 2: Use errors middleware: Branch

I suspect it might be easier to redirect to a dashboard error page with implementation 2, because the Errors middleware has a dedicated query section that should accept URL query parameters if needed.

@ibuziuk
Copy link
Member

ibuziuk commented May 19, 2022

I also lean towards the middleware errors approach without changing the traefik config.
We should be careful with the Dashboard change though, I recall it might be related to https://github.com/eclipse-che/che-operator/pull/1360/files
@olexii4 @akurinnoy wdyt?

@ibuziuk
Copy link
Member

ibuziuk commented Jun 22, 2022

@dkwon17 all the PRs have been merged, can the issue be closed?

@dkwon17
Copy link
Contributor

dkwon17 commented Jun 22, 2022

@ibuziuk I would say so. For context, refreshing the editor page of a stopped workspace now results in this page from the dashboard:
image

@dkwon17 dkwon17 closed this as completed Jun 22, 2022
@l0rd l0rd changed the title Error 503 after a workspace is idled for inactivity When a workspace is idled for inactivity user is redirected to Che dashboard Jun 23, 2022
@l0rd l0rd added new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording labels Jun 23, 2022
@max-cx
Copy link

max-cx commented Jul 25, 2022

sync'd to Red Hat Jira https://issues.redhat.com/browse/CRW-3181

@max-cx max-cx removed the status/release-notes-review-needed Issues that needs to be reviewed by the doc team for the Release Notes wording label Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gateway engine/devworkspace Issues related to Che configured to use the devworkspace controller as workspace engine. kind/enhancement A feature request - must adhere to the feature request template. new&noteworthy For new and/or noteworthy issues that deserve a blog post, new docs, or emphasis in release notes severity/P1 Has a major impact to usage or development of the system.
Projects
None yet
Development

No branches or pull requests

8 participants