-
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
Git plugin issue after network disconnection #12823
Comments
The double click no longer opening the diff editor happens to me all the time when leaving Theia alone for a little bit. |
When I return to Theia after the machine went to sleep, it looks like Theia is restarting plugins. I'm pretty convinced that can't work without a proper reset of the front end. |
Tangentially related: #11499. The consensus (I believe) is that we should aim to make the frontend survive a restart of the plugin host. |
@msujew losing application state after waking up the computer is not in line with the expectations our users (rightfully) have from a desktop application. We do disconnection detection via ping timeouts, or listening to socket connections. None of that makes any sense in the Electron case. My point is the plugin host shouldn't restart after lunch. |
Maybe the connection handling needs to be totally different between Electron/Web cases. |
Sure makes sense for the Electron use case. The issue is talking about a network disconnection though, which can realistically only happen in a browser application. |
That is true, but it seems that the computer going to sleep counts as a "network disconnection" in the Electron case. |
@tortmayr suggested adding something like the following in order to reproduce the issue without having to wait a long time:
|
A couple of observations:
|
By giving the rpc protocol instances an sequential id and sending the sender id with request messages, I was able to establish the following:
It seems like the UI elements are still connected to the old RPCProtocol instances. Also, it looks like plugins are restarted upon reconnect: I have the message "starting plugins" in the browser log twice. |
I think the problem at the base is this: the back-end is written in a way that it can handle a new front-end connecting to it. But the front-end does not really handle the case where it is connected to to a new back-end (which is equivalent to recreating the front-end from scratch). It looks like the back-end treats the closure of the underlying websocket as if a new front end was connected, thus recreating all the connection container modules. The front-end, meanwhile, is holding on to the proxies originally created.
|
This looks like a lot of scary changes! |
I think basically it looks like this from the front-end's point of view:
|
From the back end's point of view, it would look like this:
or in the case of a reconnect:
|
There is a related PR that has been closed: #11499. |
Hi, I think also that this issue is the root cause of many other issues:
|
Plugin reload on reconnect comes from #6159. The trouble with the "cleanup state on reconnect" is that we have to manually clean up all the places where we retain back-end related state. An approach based on retaining the back-end for a while could be done in one place and would be simpler. |
A couple of thoughts on lifecycle:
On the front end, the channels to the back-end are opened when we invoke |
There are several places of asynchronicity in the system:
|
How could such a startup protocol look:
|
Currently, remote services have the option to have a local "client" object that communicates back on the same services channel. IMO, this makes the code unnecessarily confusing: I would strictly separate remote services which I can call and notify and handlers which can be called and notified. |
My concrete, minimal proposal would be this:
Of course, the timeout for how long to keep the back end would have to be configurable: In the case of Electron, the timeout would be infinite, if we have a web-based solution that we deploy for a couple of developers in-house, we might want an hour, whereas if we run a public, free service, we might drop the back-end immediately upon websocket disconnect. In this way, the only downside relative to today's "reconnect" support would be that we reload the UI more often than before. "Reconnect" support requires us to be able to selectively drop all state that is related to a particular back end connection context and to rebuild it upon reconnect. Historically, we have not been very good at that. Also, all extenders would have to support "reconnect" in their extensions, as well. |
@vince-fugnitto the last comment is my proposal, basically. Since you had to drop from the dev-call, I'd be interested in your comments. |
An alternative idea, which occurred to me while talking about it in the dev call is this: if we had a "connection container module" which contains all objects related to a connection, we could do a proper reconnect. Right now, we can inject service proxies into any object in the container. If we had a child container (and the connection to the back end was only known inside that container), we would be forced to do explicitly export any objects outside of that container. |
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>
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>
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>
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>
Fixes #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>
Bug Description:
Hi,
I am using the vscode git plugin (1.77.0). When the network connection is lost, and back online again, all the plugins are reloaded back. In this case, the git plugin open changes command stops working (double click on a changed file in the source control tree or context menu command 'open changes').
The error in console log:
Steps to Reproduce:
Additional Information
The text was updated successfully, but these errors were encountered: