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:
@@ -199,16 +199,40 @@ func NewTransportManager(params TransportManagerParams) (*TransportManager, erro
|
||||
}
|
||||
|
||||
func (t *TransportManager) Close() {
|
||||
var publisherClosed atomic.Bool
|
||||
var subscriberClosed atomic.Bool
|
||||
time.AfterFunc(time.Minute, func() { // CLOSE-DEBUG-CLEANUP
|
||||
if !publisherClosed.Load() || !subscriberClosed.Load() {
|
||||
t.params.Logger.Infow(
|
||||
"transport maanager close timeout",
|
||||
"publisherClosed", publisherClosed.Load(),
|
||||
"subscriberClosed", subscriberClosed.Load(),
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
if t.publisher != nil {
|
||||
t.publisher.Close()
|
||||
}
|
||||
publisherClosed.Store(true)
|
||||
if t.subscriber != nil {
|
||||
t.subscriber.Close()
|
||||
}
|
||||
subscriberClosed.Store(true)
|
||||
}
|
||||
|
||||
func (t *TransportManager) SubscriberClose() {
|
||||
var subscriberClosed atomic.Bool
|
||||
time.AfterFunc(time.Minute, func() { // CLOSE-DEBUG-CLEANUP
|
||||
if !subscriberClosed.Load() {
|
||||
t.params.Logger.Infow(
|
||||
"transport maanager subscriber close timeout",
|
||||
"subscriberClosed", subscriberClosed.Load(),
|
||||
)
|
||||
}
|
||||
})
|
||||
t.subscriber.Close()
|
||||
subscriberClosed.Store(true)
|
||||
}
|
||||
|
||||
func (t *TransportManager) HasPublisherEverConnected() bool {
|
||||
|
||||
Reference in New Issue
Block a user