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

Fix Synchronization on Long could deadlock Reported by Findbugs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.1AS
    • Fix Version/s: 2.3.1AS
    • Component/s: Async Scaleout
    • Labels:
      None

      Description

      Local class StackDumpTimer in PrimitiveAnalysisEngineController_impl is synchronizing a block of code using a primitive (Long) which is not a good idea.
      Finbugs documentation on this bug says:

      "DL: Synchronization on boxed primitive could lead to deadlock (DL_SYNCHRONIZATION_ON_BOXED_PRIMITIVE)

      The code synchronizes on a boxed primitive constant, such as an Integer.

      private static Integer count = 0;
      ...
      synchronized(count)

      { count++; }

      ...
      Since Integer objects can be cached and shared, this code could be synchronizing on the same object as other, unrelated code, leading to unresponsiveness and possible deadlock"

        Activity

        Hide
        cwiklik Jerry Cwiklik added a comment -

        Added a new monitor to synchronize critical region in StackDumpTimer.class:

        static private Object threadDumpMonitor = new Object();

        Show
        cwiklik Jerry Cwiklik added a comment - Added a new monitor to synchronize critical region in StackDumpTimer.class: static private Object threadDumpMonitor = new Object();

          People

          • Assignee:
            cwiklik Jerry Cwiklik
            Reporter:
            cwiklik Jerry Cwiklik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development