-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Introduce timeout for keeping connection contexts alive #13082
Introduce timeout for keeping connection contexts alive #13082
Conversation
6feecea
to
976f752
Compare
@thegecko I've moved some stuff from "common" to "browser". Maybe have a look? |
packages/core/src/node/messaging/websocket-frontend-connection-service.ts
Outdated
Show resolved
Hide resolved
It looks like this is just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality wise, this is looking quite good. Will perform a final testing review once the code comments are resolved.
packages/core/src/electron-browser/messaging/electron-ipc-connection-source.ts
Outdated
Show resolved
Hide resolved
Fixes eclipse-theia#12823 - refactor front end to allow for multiple reconnections - remove IWebsockt abstractions - separate front end connections from service channel management - introduce mechanism to reconnect front end to existing connection context based on timeouts Contributed on behalf of STMicroelectronics Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
06d8df2
to
8b392e3
Compare
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
8b392e3
to
4b3e870
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well when using Theia the "normal" way.
However, I've noticed during my final testing round that this breaks the Remote SSH feature. Unfortunately I don't have time this week to see why it breaks. I can take a look at it next week, assuming you haven't found the issue yourself in the meantime.
I did test the remote ssh feature. Can you share your scenario, please? |
I can consistently reproduce it by trying to remote onto a Gitpod workspace. |
@tsmaeder Ok, so it doesn't break it completely: The application seems to be in a broken state: It is indeed connected to the backend of the remote machine (as can be seen in the Linux terminal). But the frontend still thinks it is connected to the local backend:
I assume the dual websocket thingy that I've implemented to target both the local and the remote backend broke somehow. It's now all targeting the remote backend as far as I can tell. |
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
@msujew I think I have fixed the remote problem (1-liner). if you could poke this once again, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, seems like it was a simple fix. Looks good, and can confirm that everything is working as expected now 👍
Merged with great satisfaction ;-) Thx for the review, @msujew |
Hi @tsmaeder, Many thanks for this great improvement. Theia now works much more smoothly on disconnections, no plugin reloads, and of course, the git issue is resolved, and the main issue for us was the custom editors (or any webview) that were reloaded now are not and keep their state. I will open later some issues (or questions) that I am facing now which I think are related to this change. Again many thanks for this great work. |
First of all, thank you very much for this contribution, it helped me solve a lot of problems.I have a question,What are the negative impacts of setting the parameter frontendConnectionTimeout to -1? |
The worst thing that may happen is that you leak connection contexts in the back end. If the front end never reconnects to the back end, the back end contexts remain forever. |
What it does
Fixes #12823
The basic idea of this PR is that when a the websocket connecting the front end to back-end services disconnects, we don't throw the connection context on the back end away right away, but we keep it around in case the front end reconnects. Only after a configurable timeout do we close the connection context.
Contributed on behalf of STMicroelectronics
How to test
I've added the following code into
sample-menu-contribution.ts
:The command lets you disconnect the front end websocket for a configurable amount of milliseconds. This allows to simulate the disconnection for different amounts of time.
An application package can configure the timeout behaviour in it's
package.json
. here's the electron example, for example:any negative value for
frontendConnectionTimeout
will be interpreted as "keep forever". Any positive value or zero will be milliseconds to wait before discarding the connection context after the websocket closes.The testing procedure is to run through different disconnect/reconnect scenarios:
reloadOnReconnect
(you'll have to rebuild the application to play around with the settings).Follow-ups
There are some deprecations in the code that we should clean up eventually.
Review checklist
Reminder for reviewers