Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-5880

Synchronization Problem in TxServerClientInterceptor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • JBossAS-5.0.0.CR2
    • JBossAS-4.2.2.GA
    • IIOP service
    • None

    Description

      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".

      Attachments

        Issue Links

          Activity

            People

              adrian.brock Adrian Brock (Inactive)
              rhn-support-jbertram Justin Bertram
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: