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

[dashboard] Gracefully handle websocket connection disposal #6006

Merged
merged 2 commits into from
Oct 5, 2021

Conversation

geropl
Copy link
Member

@geropl geropl commented Oct 4, 2021

Description

This avoids Error("Connection got disposed") errors which gobble up to the frontend and block users. Also, it makes the frontend's websocket connection more resilient in general: Instead of dropping calls, those are buffered and re-issued once the connection is reestablished.

Related Issue(s)

Fixes #5042.

How to test

Login to preview env

  1. go here and login
  2. note how you're re-directed on successful login with GitHub/GitLab

Start a workspace

  1. open devtools (console and network)
  2. start any workspace
  3. note how websocket connections work and open as expected

View build logs

  1. open a context that requires an image build
  2. wait until you see the log appearing
  3. terminate the websocket connection (by killing server)
  4. notice how the logs re-start scrolling automatically once server and the websocket connection is up-and-running again

Ensure closing websocket connections works

  1. kubectl port-forward deployment/server 9500
  2. curl -s localhost:9500/metrics | grep "gitpod_server_api_connections_closed_total " and remember the number
  3. close a dashboard tab for the preview environment
  4. curl -s localhost:9500/metrics | grep "gitpod_server_api_connections_closed_total " again and note how the count increased

Release Notes

improve websocket reconnection handling in the frontend
  • /werft with-clean-slate-deployment

geropl added 2 commits October 4, 2021 08:05
This avoids Error("Connection got disposed") errors which gobble up to the frontend and block users.
@akosyakov
Copy link
Member

@geropl What is the difference to previous version?

@geropl
Copy link
Member Author

geropl commented Oct 4, 2021

@akosyakov The previous version removed this section entirely, thus we never fired closed in server: https://github.com/gitpod-io/gitpod/pull/6006/files#diff-b8847df09095afd1fed8277f763df0e828b40f2e071d73f3bbc4ed8c131903f9R107-R109

@akosyakov
Copy link
Member

akosyakov commented Oct 4, 2021

/werft run

👍 started the job as gitpod-build-gpl-5042-conn-disposed-2.2

Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

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

/lgtm

It makes sense. Too bad we overlooked the server part initially.

@roboquat
Copy link
Contributor

roboquat commented Oct 4, 2021

LGTM label has been added.

Git tree hash: 930a29dc722e1f0704886cb3088c20b5c749b3ae

@geropl geropl marked this pull request as ready for review October 5, 2021 07:44
@geropl
Copy link
Member Author

geropl commented Oct 5, 2021

/approve

@roboquat
Copy link
Contributor

roboquat commented Oct 5, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akosyakov, geropl

Associated issue: #5042

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@roboquat roboquat merged commit 48e29e1 into main Oct 5, 2021
@roboquat roboquat deleted the gpl/5042-conn-disposed-2 branch October 5, 2021 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dashboard] Gracefully handle connection disposal
3 participants