Room lifecycle memory fixes - #1405
Conversation
Changeset ✓This PR includes a changeset covering all affected packages:
|
|
Hi @alan-george-lk! Thank you for proposing this fix; I believe I followed a similar approach to weakly capturing the RoomSession in #1377. For the data channel I was going to follow a similar approach to you here, but noticed we can avoid capturing the data channel in its own closure altogether by changing the interface slightly. Feel free to use that implementation if it's easier than manually unsetting the closures. |
33891b7 to
d539b63
Compare
e99174b to
7c3310a
Compare
Hey @raparanjpe, great minds think alike -- I just reviewed your PR. I think removing
I have pulled in your commit such that you get credit. We may merge this before you have a chance to review, but I'll make sure your name is in the author credits. |
|
@alan-george-lk no problem at all! |
| // closing here — before the future can suspend — is what stops a cancelled | ||
| // `close()` leaving the ICE sockets bound for the process's lifetime. The | ||
| // signalling socket is unaffected, so the Leave below still goes out. | ||
| self.lossy_dc.on_message(None); |
There was a problem hiding this comment.
You don't need to set these to None anymore as the closure isn't capturing the arc reference on these data channels!
There was a problem hiding this comment.
Good catch -- meant to remove these, thanks. Done now.
Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit 4c3b857)
ded4ec4 to
9a14150
Compare
Summary
RoomSessionownership cycle by capturing it weakly from the E2EE callbackMemory impact
Previously, repeated room joins retained room sessions, SDP/codec allocations, peer connections, and WebRTC threads. After these fixes, 1,000 connect/disconnect cycles dropped from approximately 488 MiB RSS to 44 MiB, with stable thread and file-descriptor counts.
Testing