[CONTROLLER-299] MD-SAL datastore does not defer work to other threads or thread pools Created: 09/Apr/14  Updated: 25/Jul/23  Resolved: 30/May/14

Status: Resolved
Project: controller
Component/s: mdsal
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Zoltan Lajos Kis Assignee: Mayank Agarwal
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: File RE- [controller-dev] MD-SAL data store threading model.eml     File mdsaltest.tar.gz    
External issue ID: 703

 Description   

It seems like this code results in a deadlock:

public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
DataModification<InstanceIdentifier<?>, DataObject> tx = dataBroker.beginTransaction();
...
tx.commit().get();
}

Which suggests that the call to commit() does not defer the execution to a separate thread (or thread pool), but wants to execute it on the caller thread. Despite the fact that commit() returns a Future, which suggests it to be async.

I understand that I can work around this by manipulating threads on my own (explicitly spawning, JDKFutures, etc.).

However, I believe the current behavior is against the "principle of least astonishment", and should be fixed. Or if this is the designed behavior, it should be clearly documented.

Use the attached bundle to reproduce. Once the system is stable, execute ./runme, which will trigger the data change event. That in turn will start a new transaction, and wait for it's result...

Also see this thread on the topic:
https://lists.opendaylight.org/pipermail/controller-dev/2014-April/003556.html



 Comments   
Comment by Zoltan Lajos Kis [ 09/Apr/14 ]

Attachment mdsaltest.tar.gz has been added with description: test bundle for creating deadlock

Comment by Mayank Agarwal [ 30/May/14 ]

Email discussion based on which this bug is being marked as Resolved.

Comment by Mayank Agarwal [ 30/May/14 ]

Attachment RE- [controller-dev] MD-SAL data store threading model.eml has been added with description: Email discussion

Generated at Wed Feb 07 19:52:41 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.