You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Karl Pauls (Jira)" <ji...@apache.org> on 2020/12/15 22:12:01 UTC

[jira] [Closed] (FELIX-6318) Tiny thread-safety bug in BundleWiringImpl

     [ https://issues.apache.org/jira/browse/FELIX-6318?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Pauls closed FELIX-6318.
-----------------------------

> Tiny thread-safety bug in BundleWiringImpl
> ------------------------------------------
>
>                 Key: FELIX-6318
>                 URL: https://issues.apache.org/jira/browse/FELIX-6318
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: framework-6.0.3, framework-5.6.12
>            Reporter: Richard Hernandez
>            Assignee: Jean-Baptiste Onofré
>            Priority: Minor
>             Fix For: framework-6.0.4
>
>
> 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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)