-
Bug
-
Resolution: Done
-
Major
-
JBossAS-4.2.2.GA
-
None
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[]
;
103 emptyPC.implementation_specific_data = ORB.init().create_any();
104 emptyPC.implementation_specific_data.insert_boolean(false);
105 }
106 return emptyPC;
The problem is that a second thread could see emptyPC as not null
while the first thread is still initialising the data.
The fix is to contruct a "temp" propagation context that is only assigned
to emptyPC once it is fully initialised.
SInce this is just a cached object, it doesn't really matter if a few threads at the start
of processing initialise emptyPC multiple times, the method is "idempotent".
- blocks
-
JBPAPP-1119 Backport JBAS-5880: Synchronization Problem in TxServerClientInterceptor
- Closed