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

Weak hash map usage in UnifiedInvokerHAProxy is not thread safe

XMLWordPrintable

    • High

      txFailoverAuthorizations weak hashmap that is now also used for
      maintaining transaction stickyness was created as an unsynchronized
      WeakHashMap and this was causing issues.

      It was not enough to synchronise on the tpc (key of map) whenever
      we manipulated it because two threads, trying to store different tpcs
      could end up trying to resize the map and as a result, key value
      pairs could easily dissapear from the hash map.

      This is extremely confusing because we thought the disappearance
      was due to garbage collection.

      From now on, we'll be using a Collections.synchronizedMap(new WeakHashMap());
      instead. Thanks to Adrian for the help debugging this.

              rh-ee-galder Galder ZamarreƱo
              rh-ee-galder Galder ZamarreƱo
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: