Skip to content

Commit a80c7f2

Browse files
committed
fix(removeQueue): add panic recovery and double-check for outbound removal
1 parent ebc276f commit a80c7f2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

adapter/groups/manager.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,23 @@ func (rq *removalQueue) checkPending() {
306306
}
307307

308308
if len(toRemove) > 0 {
309+
defer func() {
310+
if err := recover(); err != nil {
311+
rq.logger.Error("panic during outbound/endpoint removal", "error", err)
312+
}
313+
}()
309314
rq.mu.Lock()
310315
defer rq.mu.Unlock()
311316
for _, tag := range toRemove {
312317
item, exists := rq.pending[tag]
313318
if !exists {
314319
continue
315320
}
321+
// double check if outbound/endpoint still exists
322+
if _, exists = rq.outMgr.Outbound(tag); !exists {
323+
rq.logger.Trace("outbound already removed", "tag", tag)
324+
continue
325+
}
316326
rq.logger.Debug("removing outbound", "tag", tag)
317327
if item.isEndpoint {
318328
rq.epMgr.Remove(tag)

0 commit comments

Comments
 (0)