Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4611

Multithreaded correctness - Incorrect lazy initialization of static field

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Non-Essential
    • Resolution: Fixed
    • Affects Version/s: Platform 1.11.0
    • Fix Version/s: Platform 2.0.0
    • Component/s: None
    • Complexity:
      Low

      Description

      There are methods in some classes, which contain an unsynchronized lazy initialization of a non-volatile static field. Because the compiler or processor may reorder instructions, threads are not guaranteed to see a completely initialized object, if the method can be called by multiple threads. You can make the field volatile to correct the problem. For more information, see the Java Memory Model web site.

      Reported Classes:
      ModuleFactory (lines 451, 465, 509, etc), ServiceContext, DatabaseUpdater

      Acceptance Criteria:
      Eliminate all such errors reported by sonar:
      https://ci.openmrs.org/sonar/drilldown/issues/1865?&rule=findbugs%3ALI_LAZY_INIT_STATIC&rule_sev=CRITICAL

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tanayabh Tanay Abhra
              Reporter:
              raff Rafal Korytkowski
              Designated Committer:
              Rafal Korytkowski
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 4 hours
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified