fix(core): unbind all services in connection container on close#17384
Merged
fix(core): unbind all services in connection container on close#17384
Conversation
Add a failing test case that will pass once the DefaultMessagingService is updated to tear down the services bound in the child containers that it creates for frontend connections' backend services. Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
cdamus
commented
Apr 22, 2026
Unbind all services in the connection container on close of the socket. This lets @preDestroy hooks run in any singletons to clean up resources that they may have allocated. Fixes #17383 Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
26eda61 to
4baba9a
Compare
colin-grant-work
approved these changes
Apr 23, 2026
Contributor
colin-grant-work
left a comment
There was a problem hiding this comment.
I don't see any regressions, and I wouldn't expect any, given that Theia doesn't use Inversify lifecycle methods that trigger on unbinding widely (though I did find one preDestroy I hadn't seen before). Nevertheless, it might be worth adding a note in the changelog indicating this as a potentially breaking change, since we know that service aliases with the wrong combination of binding types and decorations could break a global service.
Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
Contributor
Author
|
Thanks for the suggestion @colin-grant-work . Commit a6049eb adds a blurb to the changelog explaining how latent footguns may go off. |
colin-grant-work
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Unbinds all services in the connection container on close of the socket. This lets
@preDestroyhooks run in any singletons to clean up resources that they may have allocated.Note that this does not interfere in any way with the timer-based reconnection strategy for fault-tolerant RPC connections. The container is only unbound once the connection is definitively closed. If a connection recovers from a brief outage, then all of the backend services will still be there ready to serve it.
Fixes #17383
How to test
Besides the included new automated test, add an
@preDestroyclean-up method to some service bound in the backend in a connection-scoped container and do what is best to observe that it runs that clean-up when a frontend disconnects.Follow-ups
None.
Breaking changes
Attribution
None.
Review checklist
nlsservice (for details, please see the Internationalization/Localization section in the Coding Guidelines)Reminder for reviewers