Add checks for participant and sub-components close. (#4100)

* Add checks for participant and sub-components close.

Looks like there might be some memory leak with participant sessions not
getting closed properly. Adding checks (to be cleaned up later) to see
if there is a consistent place where things might hang.

* init with right type

* Remove unnecessary goroutine, thank you @milos-lk

* clean up
This commit is contained in:
Raja Subramanian
2025-11-24 18:07:33 +05:30
committed by GitHub
parent ffbabcc772
commit 70f6def39d
5 changed files with 117 additions and 4 deletions
+15
View File
@@ -104,7 +104,21 @@ func (m *SubscriptionManager) Close(isExpectedToResume bool) {
close(m.closeCh)
m.lock.Unlock()
var done atomic.Bool
var downTracksClosed atomic.Bool
time.AfterFunc(time.Minute, func() { // CLOSE-DEBUG-CLEANUP
if !done.Load() || !downTracksClosed.Load() {
m.params.Logger.Infow(
"subscription maanager close timeout",
"done", done.Load(),
"downTracksClosed", downTracksClosed.Load(),
"numSubscribedTracks", len(m.GetSubscribedTracks()),
)
}
})
<-m.doneCh
done.Store(true)
subTracks := m.GetSubscribedTracks()
downTracksToClose := make([]*sfu.DownTrack, 0, len(subTracks))
@@ -127,6 +141,7 @@ func (m *SubscriptionManager) Close(isExpectedToResume bool) {
go dt.CloseWithFlush(true)
}
}
downTracksClosed.Store(true)
}
func (m *SubscriptionManager) isClosed() bool {