9 Replies Latest reply on Aug 20, 2008 7:02 AM by Manik Surtani

    Concurrency issue in OrderedSynchronizationHandler (2.0.0GA

    Lars J. Nilsson Newbie

      Hi,

      Two issues/questions regarding OrderedSynchronizationHandler.

      1) The "instances" member is not synchronized

      OrderedSynchronizationHandler seems to have an unguarded static HashMap member called "instances". This is a potentional crash issue. On one of our instances (in a four member cluster) with medium high load (aprox 1500 transaction per second), the CPU flat-lined on 200% with 21 threads caught and spinning in HashMap.get(Object) as called from OrderedSynchronizationHandler.getInstance(Transaction). I'll copy a typical stack trace below.

      2) The "instances" member is static
      This is more of a question. If several caches are run within the same VM/ClassLoader they will all share the "instances" member. This seems fairly inefficient, especially if the map in question needs to be synchronized as per #1.

      Below is a typical, slightly trunctated, stack trace for issue #1.

      "Incoming Thread,TableSpace,172.16.0.2:8786" daemon prio=1 tid=0x097e9208 nid=0x14de runnable [0x83228000..0x83229030]
       at java.util.HashMap.get(HashMap.java:346)
       at org.jboss.cache.interceptors.OrderedSynchronizationHandler.getInstance(OrderedSynchronizationHandler.java:50)
       at org.jboss.cache.interceptors.TxInterceptor.registerHandler(TxInterceptor.java:901)
       at org.jboss.cache.interceptors.TxInterceptor.handleRemotePrepare(TxInterceptor.java:246)
       at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:100)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:76)
       at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:123)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:76)
       at org.jboss.cache.interceptors.InvocationContextInterceptor.invoke(InvocationContextInterceptor.java:62)
       at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:76)
       at com.cubeia.space.cache.HaltableInterceptor.invoke(HaltableInterceptor.java:32)
       at org.jboss.cache.CacheImpl.invokeMethod(CacheImpl.java:3939)
       at org.jboss.cache.CacheImpl._replicate(CacheImpl.java:2853)
      


      What say you?
      /Lars J. Nilsson
      Cubeia Ltd, UK Fillial