[jboss-jira] [JBoss JIRA] Closed: (JBAS-5880) Synchronization Problem in TxServerClientInterceptor
Adrian Brock (JIRA)
jira-events at lists.jboss.org
Mon Aug 25 11:51:39 EDT 2008
[ https://jira.jboss.org/jira/browse/JBAS-5880?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adrian Brock closed JBAS-5880.
------------------------------
Fix Version/s: JBossAS-5.0.0.CR2
Resolution: Done
> 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: Adrian Brock
> Fix For: JBossAS-5.0.0.CR2, 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;
> 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".
--
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
More information about the jboss-jira
mailing list