Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-1378

EntityManagerRefLookup returns null globalEntityManager when lazyInitGlobalEntityManager is called by multiple threads

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.9.0
    • 1.9.1
    • JPA-Module
    • None

    Description

      Situation

      If multiple threads invoke lazyInitGlobalEntityManager at same time and lazyInitGlobalEntityManager isn't invoked before. Some of these threads might end up with a null entitymanager, because lazyInitGlobalEntityManager isn't synchronized (or this.globalEntityManagerInitialized = true is at wrong place).

      Might be important to fix this, because In rare situations this might break your application and even cause inconsistent data.

      Problem

      entityManager is null after initialization is concurrently called

      Expected

      entityManager won't be null when initialized concurrently

       

      PR

      https://github.com/apache/deltaspike/pull/89

      Attachments

        Issue Links

          Activity

            People

              tandraschko Thomas Andraschko
              rdomingonl Raymond Domingo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: