From acfc9ad7f9853ccd7b8a1c442f644e71434d5f9c Mon Sep 17 00:00:00 2001 From: Carl Baldwin Date: Mon, 27 Aug 2018 15:45:36 +0000 Subject: Release read lock before calling llgrFamilies llgrFamilies gets a read lock itself but the caller already has one. Deadlock occurs when another goroutine is blocked on a write lock. Addresses #1818 --- pkg/server/peer.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkg') diff --git a/pkg/server/peer.go b/pkg/server/peer.go index 1f67fd48..632e14a4 100644 --- a/pkg/server/peer.go +++ b/pkg/server/peer.go @@ -282,8 +282,9 @@ func (peer *Peer) llgrFamilies() ([]bgp.RouteFamily, []bgp.RouteFamily) { func (peer *Peer) isLLGREnabledFamily(family bgp.RouteFamily) bool { peer.fsm.lock.RLock() - defer peer.fsm.lock.RUnlock() - if !peer.fsm.pConf.GracefulRestart.Config.LongLivedEnabled { + llgrEnabled := peer.fsm.pConf.GracefulRestart.Config.LongLivedEnabled + peer.fsm.lock.RUnlock() + if !llgrEnabled { return false } fs, _ := peer.llgrFamilies() -- cgit v1.2.3