BUG-8898: do not invoke timeouts directly 80/60980/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 31 Jul 2017 13:54:12 +0000 (15:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 1 Aug 2017 12:07:58 +0000 (14:07 +0200)
commit5a04e042052a3c13fa4677f236a7107a801c7421
treeb864b97e649770adcdc7d7d5d7c87c74e078e1ca
parent93b203c3e2223018000af3472e8eca5363152910
BUG-8898: do not invoke timeouts directly

Request timeouts are occuring with the connection lock held,
at which point the connection can be at the tail of a successor
chain:

oldestConnection -> olderConnection -> connection

If the callback being invoked attempts to transmit an entry,
we will end up attempting to lock the entire chain. This would not
be a problem except that if there is a concurrent attempt to lock
the entire chain it ends up holding the lock of oldestConnection
and it is waiting for the lock on connection -- which will only be
released once the callback finishes executing, but that in turn
waits for oldestConnection to be unlocked -- a classic AB/BA deadlock.

This patch alleviates the problem by deferring callback execution
via executeInActor, i.e. the timeout will be delivered at as part
of normal message processing.

Change-Id: I237908cf214bcdfd477fe0212d09b207a0c2cdbf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4367f456f3c7a30c8ee9c7bca738b3e120a4e1d1)
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java