-
Notifications
You must be signed in to change notification settings - Fork 127
Fix resource leaks when we stop using a connection #3537
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
Merged
robintown
merged 5 commits into
element-hq:voip-team/rebased-multiSFU
from
robintown:connection-leaks
Oct 21, 2025
Merged
Fix resource leaks when we stop using a connection #3537
robintown
merged 5 commits into
element-hq:voip-team/rebased-multiSFU
from
robintown:connection-leaks
Oct 21, 2025
Conversation
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
Previously we had a ViewModel class which was responsible for little more than creating an ObservableScope. However, since this ObservableScope would be created implicitly upon view model construction, it became a tad bit harder for callers to remember to eventually end the scope (as you wouldn't just have to remember to end ObservableScopes, but also to destroy ViewModels). Requiring the scope to be specified explicitly by the caller also makes it possible for the caller to reuse the scope for other purposes, reducing the number of scopes mentally in flight that need tending to, and for all state holders (not just view models) to be handled uniformly by helper functions such as generateKeyed$.
The execution of certain Observables related to a local or remote connection would continue even after we stopped caring about said connection because we were failing to give these state holders a proper ObservableScope of their own, separate from the CallViewModel's longer-lived scope. With this commit they now have scopes managed by generateKeyed$.
toger5
reviewed
Oct 20, 2025
toger5
reviewed
Oct 20, 2025
toger5
reviewed
Oct 21, 2025
toger5
approved these changes
Oct 21, 2025
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 looks good.
The generateKeyed$ also seems like an obvious candidate for the CallMembership static function on the RTCSession. (sadly this is js-sdk. But once we build our own rtc sdk that might be interesting again)
4936cdf
into
element-hq:voip-team/rebased-multiSFU
14 of 17 checks passed
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.
The execution of certain Observables related to a local or remote connection would continue even after we stopped caring about said connection because we were failing to give these state holders a proper ObservableScope of their own, separate from the CallViewModel's longer-lived scope. With this commit they now have scopes managed by a new helper function
generateKeyed$.Please take a look at the individual commits when reviewing. The first commit introduces a refactor that makes scope management less error-prone and makes
generateKeyed$possible to implement, the second one actually fixes the resource leaks, and the third is just an additional bit of test clean-up that the refactor enabled.