Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-6318

Tiny thread-safety bug in BundleWiringImpl

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • framework-6.0.3, framework-5.6.12
    • framework-6.0.4
    • Framework
    • None

    Description

      In BundleWiringImple::getClassLoaderInternal, you're using double-checked locking to access the field m_classLoader. However, you're not using it entirely correctly. The current code assigns the volatile field to a local variable, null-checks the volatile field, and returns the local variable if the second read of the volatile field is not null. While highly improbable, it's possible for the first read of the volatile variable to be null and the second read to not be. This would cause `BundleWiringImpl::getClassLoader` to return null.

       

      See https://github.com/apache/felix-dev/blob/master/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java#L713-L717

      Attachments

        Issue Links

          Activity

            People

              jbonofre Jean-Baptiste Onofré
              rhernandez35 Richard Hernandez
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: