Uploaded image for project: 'UIMA'
  1. UIMA
  2. UIMA-1153

thread safety issue with sample flow controller AdvancedFixedFlowController

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.2.2
    • None
    • Async Scaleout, Examples
    • None

    Description

      The AdvancedFixedFlowController implements its Flow Object class as an inner class of its Flow Controller class.

      In UIMA-AS, it is possible that more than one Flow Object can be accessing the Flow Controller fields on different threads, and (for Cas Multipliers) it is possible for an individual Flow Object to be called on multiple threads at the same time (via the method (via the newCasProduced method).

      In the example, the newCasProduced method is marked synchronized, so I think the same Flow Object will not be running multiple threads at the same time, because the other methods to this are all calls done on 1 thread on behalf of the main CAS associated with this Flow Object.

      However, multiple flow objects running on different threads could have their newCasProduced method called. In this case, the references in that method to common mutable fields in the shared Flow Controller object are not synchronized. This code should be fixed so that those references are synchronized on the same monitor used to synchronize other field access in the Flow Controller. UIMA-1149 I hope will use the class instance of the flow controller for this purpose, and, assuming that it does, this code should explicitly synchronize on that same object, for references to mutable fields in that class. There is one field, mSequence, which is in the associated Flow Controller class, which is mutable (in theory). References to this field should be synchronized with the same monitor used by the flow controller class when manipulating it.

      The other field references in the flow object should be checked, and synchronized if they refer to mutable Flow Controller fields.

      Attachments

        Activity

          People

            burn Burn L. Lewis
            schor Marshall Schor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: