Address deadlock scenarios in BGP peer, session mgmt code 10/86010/3
authorAjay Lele <ajayslele@gmail.com>
Wed, 30 Oct 2019 00:13:15 +0000 (17:13 -0700)
committerRobert Varga <nite@hq.sk>
Thu, 5 Dec 2019 14:48:17 +0000 (14:48 +0000)
commit3c882e4f71e90c8eb0efa42ba9b946f9b2264a24
tree434062340898d9a1545d1a85e774371a8e9d90ec
parent678eb7d8895024e87dbf201a3cc957be5ba50841
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>
(cherry picked from commit c23ee5e55cb94faf602d8ef16f109af7023ed8ed)
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