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

fix: adds WebSocket ping to interactive terminal (#14191) #14192

Merged
merged 1 commit into from
Jul 7, 2023

Conversation

erhudy
Copy link
Contributor

@erhudy erhudy commented Jun 23, 2023

This adds a WebSocket ping message on a 5-second interval, sent from the server to the client. This ensures that the interactive terminal will remain open and won't be closed by load balancers that are reaping idle connections.

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Please see Contribution FAQs if you have questions about your pull-request.

@codecov
Copy link

codecov bot commented Jun 23, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.01 🎉

Comparison is base (ec2fff5) 49.61% compared to head (a218ef5) 49.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #14192      +/-   ##
==========================================
+ Coverage   49.61%   49.62%   +0.01%     
==========================================
  Files         256      257       +1     
  Lines       43829    43973     +144     
==========================================
+ Hits        21744    21820      +76     
- Misses      19948    20006      +58     
- Partials     2137     2147      +10     
Impacted Files Coverage Δ
server/application/terminal.go 12.44% <0.00%> (-0.24%) ⬇️
server/application/websocket.go 4.54% <0.00%> (-1.43%) ⬇️

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>
@erhudy erhudy changed the title Fixes #14191: adds WebSocket ping fix: adds WebSocket ping to interactive terminal (#14191) Jun 23, 2023
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

@erhudy let's get this into 2.8 at least. If it doesn't cause any problems, we can cherry-pick back to previous releases.

@crenshaw-dev crenshaw-dev merged commit f2105d9 into argoproj:master Jul 7, 2023
@crenshaw-dev
Copy link
Member

/cherry-pick release-2.8

gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Jul 7, 2023
This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>
gcp-cherry-pick-bot bot pushed a commit that referenced this pull request Jul 7, 2023
This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>
crenshaw-dev pushed a commit that referenced this pull request Jul 7, 2023
…#14192) (#14399)

* fix: adds WebSocket ping to interactive terminal (#14191) (#14192)

This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>

* fix: adds WebSocket ping to interactive terminal (#14191) (#14192)

This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>

---------

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>
Co-authored-by: Edmund Rhudy <erhudy@users.noreply.github.com>
yyzxw pushed a commit to yyzxw/argo-cd that referenced this pull request Aug 9, 2023
…goproj#14192)

This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>
@suzaku suzaku mentioned this pull request Aug 15, 2023
@bradenwright-opunai
Copy link

What version was this added to, I' on v2.8.0+804d4b8 but we are still running into this issue.

@bradenwright-opunai
Copy link

Fwiw, I tried to upgrade to v2.8.3+77556d9 but it still seems to hang, any idea of what version got fixed or if there is a further problem.

@erhudy
Copy link
Contributor Author

erhudy commented Sep 12, 2023

I am running 2.8.2 and the fix is certainly present there, which I just verified by leaving a terminal open for more than 60 seconds.

@bradenwright-opunai
Copy link

bradenwright-opunai commented Sep 13, 2023

@erhudy do you have a way for me to confirm that the fix is trying to keep the terminal open or not. So I can determine if this is a new bug. Or if some reason the fix isn't working. B/c it seems like maybe I have an edge case that the fix isn't considering.

I think the issue maybe that the Terminal is locking before if hits 1 min, like for example I tried to click off and come back after 45 secs and the terminal had locked. I can check timeouts or anything else people can think of that may effect this with a Load Balancer in GCP b/c it works fine with port-forrwarding to the ArgoCD Server.

Seems like the timeout for the LB is set to 30 secs so let me try to increase that and test again.

@bradenwright-opunai
Copy link

Alright so in GCP the default timeout for a backend service is 30 secs, with the default settings the terminal was hanging. After increasing that timeout > 60 secs (currently set for 3600 secs ie 1 hr) and I've been able to wait 10+ mins and return to a working terminal. Everything is working now as expected.

I would recoomend that the docs https://argo-cd.readthedocs.io/en/stable/operator-manual/web_based_terminal/ be updated to call out the 60 sec check that now exists and that for LB's the timeout needs to be > 60 secs

@erhudy
Copy link
Contributor Author

erhudy commented Sep 13, 2023

That seems unusual. I don't have a Google Cloud environment to test in - I developed this fix against an AWS ALB where the timeout is 60 seconds, and my terminals definitely live longer than that with no activity now. It shouldn't be necessary to set a 1h timeout on your LB. I did check DevTools in Edge/Firefox/Safari to see if they recorded ping/pong activity for WebSocket but did not see anything on any browser I checked.

@bravosierrasierra
Copy link

#14271
How to enable this ping feature?

tesla59 pushed a commit to tesla59/argo-cd that referenced this pull request Dec 16, 2023
…goproj#14192)

This adds a WebSocket ping message on a 5-second interval, sent
from the server to the client. This ensures that the interactive
terminal will remain open and won't be closed by load balancers
that are reaping idle connections.

Signed-off-by: Edmund Rhudy <erhudy@users.noreply.github.com>
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.

4 participants