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

77: BaseGLSPClient should handle reconnect #197

Merged
merged 2 commits into from
Feb 13, 2024
Merged

Conversation

CamilleLetavernier
Copy link
Member

@CamilleLetavernier CamilleLetavernier commented Feb 8, 2024

Note: once the update to Theia 1.45 is in, the only required change is a Theia config option in the application, to actually enable the behavior. I don't think any change in required in GLSP itself. Typically, we want a relatively short timeout for Browser Application (especially if they are deployed to the cloud), to avoid large memory leaks, and an infinite timeout (-1) for Electron applications, as we only ever expect a single connection. I chose a 24-hours timeout, which is pretty long, because this is an example application that is typically deployed locally for testing; so we're closer to the Electron scenario (single user local deployment) than a regular web-app.

Part of eclipse-glsp/glsp#77

@tortmayr
Copy link
Contributor

tortmayr commented Feb 8, 2024

Should be merged after #196

"@theia/filesystem": "^1.39.0",
"@theia/messages": "^1.39.0",
"@theia/monaco": "^1.39.0"
"@theia/core": "^1.45.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

The breaking change was introduced with 1.44.x so this should be "^1.44.0".
I will update this in #196 accordingly

Copy link
Member Author

@CamilleLetavernier CamilleLetavernier Feb 8, 2024

Choose a reason for hiding this comment

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

Actually, I need 1.45, because this PR is integrating the changes from eclipse-theia/theia#13082. Unless I'm mistaken, these changes are only available in >= 1.45

Edit: it should even be 1.45.1, because 1.45 contains a memory leak in the reconnect feature

Copy link
Contributor

@ndoschek ndoschek left a comment

Choose a reason for hiding this comment

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

Thank you @CamilleLetavernier!
Code looks good to me, and I tested several user scenarios with the interrupt command and it works great! 🎉

@CamilleLetavernier
Copy link
Member Author

Should be merged after #196

#196 has been merged; I've rebased this PR on top. I've also re-introduced the reconnect=true parameter in the glsp-client-contribution

@tortmayr
Copy link
Contributor

tortmayr commented Feb 9, 2024

@ndoschek Thanks for reviewing this.
@CamilleLetavernier I would like to test some corner cases on my own before we merge this but in general the change looks very good to me.

@tortmayr tortmayr self-requested a review February 12, 2024 12:41
Copy link
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

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

In general the change looks good to me and for the most cases disconnect/reconnect seems to work as expected.

However, there seems to be an issue if the server sends actions/updates while the fronted is disconnected. All actions send from the server in this period are lost.

To test this I modified the example server to send a status action with an incremented counter every second. If I disconnect the frontend for 10 seconds you can see that 10 status updates are lost:

image

This is especially critical if the client has a promise that his waiting for a server response (e.g. request actions or progress updates). E.g. if you disconnect during the initial model loading nothing happens after reconnect (i.e. the diagram stays empty).

AFAIK Theia has buffering in place to cache messages that are sent via the service socket while disconnected. So I think the issue here is somewhere in our GLSP frontend code.

Nevertheless we could still merge this and work on the mentioned issues in a follow-up PR.

@CamilleLetavernier
Copy link
Member Author

This is especially critical if the client has a promise that his waiting for a server response (e.g. request actions or progress updates). E.g. if you disconnect during the initial model loading nothing happens after reconnect (i.e. the diagram stays empty).

AFAIK Theia has buffering in place to cache messages that are sent via the service socket while disconnected. So I think the issue here is somewhere in our GLSP frontend code.

Thanks for the review and feedback! Indeed, I was focusing on more "local" use cases, where e.g. the computer goes to sleep for a prolonged period of time (which is a very common issue in local development or electron scenarios). In such cases, we are unlikely to have any pending request. However, for real deployment, network failures are a totally realistic scenario we should handle.

Nevertheless we could still merge this and work on the mentioned issues in a follow-up PR.

That would be great! I think this PR already handles a number of use cases, and we can further improve on it in follow-ups.

@CamilleLetavernier
Copy link
Member Author

CamilleLetavernier commented Feb 13, 2024

I've removed the test command commit from the PR.

Edit: we decided to keep the test command in the Workflow Example, so I've restored it again :)

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.

3 participants