Synchronization Problem in TxServerClientInterceptor
-----------------------------------------------------
Key: JBAS-5880
URL:
https://jira.jboss.org/jira/browse/JBAS-5880
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: IIOP service
Affects Versions: JBossAS-4.2.2.GA
Reporter: Justin Bertram
Assignee: Stefan Guilhen
Fix For: JBossAS-4.2.4.GA
We found a synchronization problem when starting JBoss under load. In class
TxServerClientInterceptor method getEmptyPropagationContext a static member is initialized
without being synchronized.
While one thread is still initializing the otid member in line 100, an other thread
assigns a new object to the "current" member so that otid is null.
... BINGO
sniplet from TxServerClientInterceptor
090 static PropagationContext getEmptyPropagationContext()
091 {
092 if (emptyPC == null)
093 {
094 // According to the spec, this should all be ignored
095 // But we get NPEs if it doesn't contain some content
096 emptyPC = new PropagationContext();
097 emptyPC.parents = new TransIdentity[0];
098 emptyPC.current = new TransIdentity();
099 emptyPC.current.otid = new otid_t();
100 emptyPC.current.otid.formatID = 666;
101 emptyPC.current.otid.bqual_length = 1;
102 emptyPC.current.otid.tid = new byte[] { (byte) 1 };
103 emptyPC.implementation_specific_data = ORB.init().create_any();
104 emptyPC.implementation_specific_data.insert_boolean(false);
105 }
106 return emptyPC;
Note: Please keep in mind that synchronization is done only if the emtyPC object needs
initialization:
static PropagationContext getEmptyPropagationContext()
{
if (emptyPC == null)
{
syncronized(any){
if (emptyPC == null)
{
tempEmptyPc = new PropagationContext();
tempEmptyPC.parents = new ....
// assign as late as possible
emptyPC = tempEmptyPc;
}
}
}
return emptyPC;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira