Address deadlock scenarios in BGP peer, session mgmt code 26/85426/3
authorAjay Lele <ajayslele@gmail.com>
Wed, 30 Oct 2019 00:13:15 +0000 (17:13 -0700)
committerRobert Varga <nite@hq.sk>
Fri, 22 Nov 2019 09:32:07 +0000 (09:32 +0000)
commitc23ee5e55cb94faf602d8ef16f109af7023ed8ed
tree51e38ffc0ebd870213f9f36049340df3865a4605
parent3bcf2d2bf47019d133021f0850045506f7257231
Address deadlock scenarios in BGP peer, session mgmt code

In scenario-1, BGPPeer and BGPSessionImpl was acquiring locks in opposite order,
resulting in deadlock. Addressed it by enforcing same order of locking i.e.
[BGPPeer (listener) -> BGPSessionImpl (session)].
In scenario-2, deadlock was because of BGPProtocolSessionPromise and StrictBGPPeerRegistry
acquiring locks in opposite order. Addressed by using concurrent Set obviating
need to acquire lock on StrictBGPPeerRegistry object.

JIRA: BGPCEP-884
Change-Id: I9e05adde3220191c8f8436bd76fb25dbfc251e49
Signed-off-by: Ajay Lele <ajayslele@gmail.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistry.java