From 326784b667c9bf8aa75a514605cdf62995123199 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sun, 23 Feb 2025 01:23:37 +0100 Subject: [PATCH] Fix Outbound deadlock --- adapter/outbound/manager.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapter/outbound/manager.go b/adapter/outbound/manager.go index 977fe4ca..44ac8bc5 100644 --- a/adapter/outbound/manager.go +++ b/adapter/outbound/manager.go @@ -246,8 +246,6 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log. if err != nil { return err } - m.access.Lock() - defer m.access.Unlock() if m.started { for _, stage := range adapter.ListStartStages { err = adapter.LegacyStart(outbound, stage) @@ -256,6 +254,8 @@ func (m *Manager) Create(ctx context.Context, router adapter.Router, logger log. } } } + m.access.Lock() + defer m.access.Unlock() if existsOutbound, loaded := m.outboundByTag[tag]; loaded { if m.started { err = common.Close(existsOutbound)