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:
@@ -1554,11 +1554,31 @@ func (p *ParticipantImpl) Close(sendLeave bool, reason types.ParticipantCloseRea
|
||||
// Close peer connections without blocking participant Close. If peer connections are gathering candidates
|
||||
// Close will block.
|
||||
go func() {
|
||||
var smClosed atomic.Bool
|
||||
var tmClosed atomic.Bool
|
||||
var mcClosed atomic.Bool
|
||||
var mrClosed atomic.Bool
|
||||
time.AfterFunc(time.Minute, func() { // CLOSE-DEBUG-CLEANUP
|
||||
if !smClosed.Load() || !tmClosed.Load() || !mcClosed.Load() || !mrClosed.Load() {
|
||||
p.params.Logger.Infow(
|
||||
"participant close timeout",
|
||||
"smClosed", smClosed.Load(),
|
||||
"tmClosed", tmClosed.Load(),
|
||||
"mcClosed", mcClosed.Load(),
|
||||
"mrClosed", mrClosed.Load(),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
p.SubscriptionManager.Close(isExpectedToResume)
|
||||
smClosed.Store(true)
|
||||
p.TransportManager.Close()
|
||||
tmClosed.Store(true)
|
||||
|
||||
p.metricsCollector.Stop()
|
||||
mcClosed.Store(true)
|
||||
p.metricsReporter.Stop()
|
||||
mrClosed.Store(true)
|
||||
}()
|
||||
|
||||
p.dataChannelStats.Stop()
|
||||
|
||||
Reference in New Issue
Block a user