Address deadlock scenarios in BGP peer, session mgmt code 09/86009/2
authorAjay Lele <ajayslele@gmail.com>
Wed, 30 Oct 2019 00:13:15 +0000 (17:13 -0700)
committerAjay Lele <ajayslele@gmail.com>
Wed, 27 Nov 2019 04:10:04 +0000 (20:10 -0800)
commitd50e0d3a4650cd117365b4711e5c9d1341bee712
tree4d96e3c7891d60f1e439b3d1c1b441007524ff9e
parentaa5d512b5de1567ecf5cfb2104695e95f8e0d4ad
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