13 Replies Latest reply on Jun 22, 2006 9:27 PM by William DeCoste

    Synchronization on StatefulContainer

    Clebert Suconic Master

      Michael Yuan showed me a stack trace of some performance tests he is doing with EJB3 and Seam.

      After the test is finished, it looks like there is an infinite loop at this point:

      Several threads hanging on this point:

       at java.util.HashMap.put(HashMap.java:385)
       at org.jboss.ejb3.stateful.StatefulContainer.localInvoke
       at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke
       at $Proxy71.getSize(Unknown Source)
       at sun.reflect.GeneratedMethodAccessor191.invoke(Unknown
       at sun.reflect.DelegatingMethodAccessorImpl.invoke
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.myfaces.el.PropertyResolverImpl.getProperty
       at org.apache.myfaces.el.PropertyResolverImpl.getValue
       at org.apache.myfaces.el.ELParserHelper

      Looking at StatefulContainer, I can see two possible mistakes:

       if (info.unadvisedMethod != null)
       invokedMethod.put(id, info.unadvisedMethod);

      I- This is leaking. unadvisedMethos is always != null, hence invokedMethod is always getting a new put

      II - This is non sycnrhonized, so I guess it makes sense the infinite loop.