Uploaded image for project: 'controller'
  1. controller
  2. CONTROLLER-299

MD-SAL datastore does not defer work to other threads or thread pools

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Cannot Reproduce
    • None
    • None
    • mdsal
    • None
    • Operating System: All
      Platform: All

    • 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

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mayagarw@cisco.com Mayank Agarwal
            zoltan.lajos.kis@ericsson.com Zoltan Lajos Kis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: