BUG-8898: do not invoke timeouts directly 34/60934/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 31 Jul 2017 13:54:12 +0000 (15:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 31 Jul 2017 13:54:12 +0000 (15:54 +0200)
commit4367f456f3c7a30c8ee9c7bca738b3e120a4e1d1
tree796853a2b332220f9ac4963852fd757eaf7e87d1
parentf7954840090482a04f8a3b0ebe97d0fa692c66f5
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>
opendaylight/md-sal/cds-access-client/src/main/java/org/opendaylight/controller/cluster/access/client/AbstractClientConnection.java