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
+24
View File
@@ -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 {