[OPNFLWPLUG-394] Read failures in StatAbstractListenCommit Created: 03/Apr/15  Updated: 27/Sep/21  Resolved: 03/Apr/15

Status: Resolved
Project: OpenFlowPlugin
Component/s: General
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Tom Pantelis Assignee: Tom Pantelis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 2945

 Description   

With CDS, I noticed several "transaction is closed" ReadFailedExceptions in the log with corresponding messages re: ReadData messages going to dead letters. I tracked the issue to the StatAbstractListenCommit class. This is easily reproduced via the steps in https://bugs.opendaylight.org/show_bug.cgi?id=2588.

StatAbstractListenCommit contains a volatile currentReadTx which is created lazily and used to perform reads in the readLatestConfiguration method. It also has an onDataChanged callback method whose only purpose is to close the currentReadTx. It looks like this is done because the DOM read-only Tx captures a snapshot of the data when first created so when data changes it assumes the RO Tx snapshot is now stale so it closes the Tx. However the synchronization between the 2 methods isn’t correct, i.e. the currentReadTx instance is published before the read call is performed during which time onDataChanged could be called to close it. While I observed this scenario with CDS, it could also occur with IMDS.

I prototyped changes to add a currentReadTxStale flag and setting it in onDataChanged instead of blindly closing the Tx. In readLatestConfiguration, if currentReadTxStale id set, it closes the previous Tx and creates a new one. This prevents onDataChanged from affecting in-flight reads. I ran the repro steps several times with no errors.

However, the same issue could occur if readLatestConfiguration could be called concurrently. I'm not familiar with the rest of the code so unclear about the calling patterns. I'm guessing readLatestConfiguration can't be called concurrently as the code that I checked in the call chain doesn't appear to be thread-safe.



 Comments   
Comment by Tom Pantelis [ 03/Apr/15 ]

Submitted https://git.opendaylight.org/gerrit/#/c/17684/3

Generated at Wed Feb 07 20:32:21 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.