Fix unsynchronized access to TransactionChain 85/14285/1
authorRobert Varga <rovarga@cisco.com>
Tue, 20 Jan 2015 12:08:54 +0000 (13:08 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 20 Jan 2015 12:08:54 +0000 (13:08 +0100)
commit4fa6575c890501ef7e6016e65add3dc80d353f57
tree6242640da14e7e03a500f3e3edef74834151183a
parent9696218c43efa3b515001123d855668249fa4938
Fix unsynchronized access to TransactionChain

The background resynchronization task instantiated transactions without
holding RIBImpl lock, leading to:

Exception in thread "Thread-29" java.lang.IllegalStateException: Previous transaction DOM-OPER-1298 is not ready yet
        at com.google.common.base.Preconditions.checkState(Preconditions.java:176)
        at org.opendaylight.controller.md.sal.dom.store.impl.DOMStoreTransactionChainImpl$Allocated.getSnapshot(DOMStoreTransactionChainImpl.java:68)
        at org.opendaylight.controller.md.sal.dom.store.impl.DOMStoreTransactionChainImpl.getSnapshot(DOMStoreTransactionChainImpl.java:111)
        at org.opendaylight.controller.md.sal.dom.store.impl.DOMStoreTransactionChainImpl.newReadWriteTransaction(DOMStoreTransactionChainImpl.java:131)
        at org.opendaylight.controller.md.sal.dom.broker.impl.AbstractDOMForwardedTransactionFactory.newReadWriteTransaction(AbstractDOMForwardedTransactionFactory.java:206)
        at org.opendaylight.controller.md.sal.dom.broker.impl.PingPongTransactionChain.slowAllocateTransaction(PingPongTransactionChain.java:127)
        at org.opendaylight.controller.md.sal.dom.broker.impl.PingPongTransactionChain.allocateTransaction(PingPongTransactionChain.java:144)
        at org.opendaylight.controller.md.sal.dom.broker.impl.PingPongTransactionChain.newReadWriteTransaction(PingPongTransactionChain.java:295)
        at org.opendaylight.controller.md.sal.dom.broker.impl.PingPongTransactionChain.newWriteOnlyTransaction(PingPongTransactionChain.java:326)
        at org.opendaylight.controller.md.sal.binding.impl.BindingTranslatedTransactionChain.newWriteOnlyTransaction(BindingTranslatedTransactionChain.java:77)
        at org.opendaylight.protocol.bgp.rib.impl.RIBImpl$1.run(RIBImpl.java:125)
        at java.lang.Thread.run(Thread.java:745)

Change-Id: I8b5b34f313dbd1b2584ea73aef37fb6e5c6b5120
Signed-off-by: Robert Varga <rovarga@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java