Bug 978603

Summary: Possible race in jboss-invocation proxies resulting in NPE in initializer
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Stuart Douglas <sdouglas>
Component: EEAssignee: Stuart Douglas <sdouglas>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0, 6.0.1, 6.1.0, 6.0.2 (SOA)CC: bmaxwell, cdewolf, jawilson, myarboro, ochaloup, rdickens, sdouglas, smumford, wfink
Target Milestone: ER3   
Target Release: EAP 6.1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
In previous versions of Red Hat JBoss Enterprise Application Platform 6 the jboss-invocation was using a ThreadLocal to pass information into the proxies static initializer. As a result, there was a very short window where if a second thread attempted to use the proxy immediately after it had been defined this second thread would call the static initializer, and the ThreadLocal data that the initializer was expecting would not be present, resulting in a NullPointerException. This behavior has been corrected in this release of the product and the NPE will no longer be encountered.
Story Points: ---
Clone Of:
: 981846 (view as bug list) Environment:
Last Closed: 2013-09-16 20:26:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 981846    

Description Stuart Douglas 2013-06-26 22:27:35 UTC
jboss-invocation proxies use a thread local to pass information into the initializer, in most cases this works fine as long as only a single thread is attempting to define the class. It is possible for a different thread to load the class that the one that defines it.

As far as I can tell this will only affect CMP, as most other proxies are created at deployment time in a single thread.

Comment 3 Stuart Douglas 2013-06-27 00:28:49 UTC
The patch for this issue is only a few lines of code and is already completed, and has passed CI runs against Wildfly upstream, EAP 6.x and EAP 6.1 repositories.

Comment 7 JBoss JIRA Server 2013-07-01 00:03:06 UTC
Stuart Douglas <stuart.w.douglas> updated the status of jira WFLY-1595 to Resolved

Comment 8 Carlo de Wolf 2013-07-23 14:23:48 UTC
*** Bug 982083 has been marked as a duplicate of this bug. ***

Comment 9 Ondrej Chaloupka 2013-08-08 14:26:45 UTC
Verified on EAP 6.1.1.ER4.
The jboss-invocation is under version 1.1.2.
Checked the decompiled code as well.

Comment 10 Scott Mumford 2013-08-20 04:35:01 UTC
Stuart, is it possible to get an outline of this issue for a release note. 
I read that there was a possible race condition, but unfortunately, the details pertaining to the initializer, threads and defining classes is a bit beyond me.

We ideally need a cause (the underlying problem in the code), the consequence (how this problem manifested in the products behavior), the fix (what what changed in the code) and the result (how the product behaves after the change).

Any info you can offer will be appreciated and will help to make the Release Notes the best document it can be.

Comment 11 Stuart Douglas 2013-08-20 06:44:08 UTC
Because jboss-invocation was using a ThreadLocal to pass information into the proxies static initializer, there was a very short window where if a second thread attempted to use the proxy immediately after it had been defined this second thread would call the static initializer, and the ThreadLocal data that the initializer was expecting would not be present, resulting in a NullPointerException.