1 2 Previous Next 26 Replies Latest reply on Aug 11, 2009 5:17 AM by Michael Knapp

    Ajax queues concurrency woes

    Michael Knapp Newbie

      I noticed that concurrent ajax events may interfere each other, then several exceptions pop up like:

      16:49:58,031 ERROR [[facesservlet]] Servlet.service() for servlet facesservlet threw exception
      java.lang.ArrayIndexOutOfBoundsException: -1
       at java.util.ArrayList.fastRemove(ArrayList.java:441)
       at java.util.ArrayList.remove(ArrayList.java:424)
       at javax.faces.component.UIComponentBase$AttributesMap.remove(UIComponentBase.java:1695)
       at com.sun.facelets.tag.jsf.ComponentSupport.finalizeForDeletion(ComponentSupport.java:54)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:173)
       at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
       at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
       at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
       at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
       at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
       at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
       at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)
       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
      


      and

      16:47:48,515 WARN [lifecycle] JSF1053: (Listener: org.ajax4jsf.event.AjaxPhaseListener.afterPhase(), Phase ID: RESTORE_VIEW 1, View ID: /queuetest.jsf) Exception thrown during phase-listener executi
      on: java.util.ConcurrentModificationException
      16:47:48,515 WARN [lifecycle] java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
      java.util.HashMap$KeyIterator.next(HashMap.java:828)
      org.ajax4jsf.event.AjaxPhaseListener.afterPhase(AjaxPhaseListener.java:79)
      com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
      com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
      com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:103)
      com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
      org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      java.lang.Thread.run(Thread.java:619)
      


      I have created an implemented an example to show this problem.
      This example crashes after a short time with the exceptions above


      JSF code

       <f:view>
       <a4j:region>
       <a4j:form>
      
       <a4j:queue name="queue1" />
       <a4j:queue name="queue2" />
      
       <a4j:jsFunction name="doCount1" actionListener="#{test.doCount1}" eventsQueue="queue1" reRender="count1" ajaxSingle="true" />
       <a4j:jsFunction name="doCount2" actionListener="#{test.doCount2}" eventsQueue="queue2" reRender="count2" ajaxSingle="true" />
      
       <a4j:outputPanel layout="block" id="count1" >
       <h:outputText value="Count 1 : #{test.count1}" />
       </a4j:outputPanel>
      
       <a4j:outputPanel layout="block" id="count2" >
       <h:outputText value="Count 2 : #{test.count2}" />
       </a4j:outputPanel>
      
       <a4j:outputPanel layout="block" id="counts" >
       <h:outputText value="Count 1 : #{test.count1}" />
       <br />
       <h:outputText value="Count 2 : #{test.count2}" />
       </a4j:outputPanel>
      
       <script type="text/javascript" >
       window.setInterval('doCount1()', 50);
       window.setInterval('doCount2()', 50);
       </script>
      
       </a4j:form>
       </a4j:region>
      
       <a4j:region>
       <a4j:form id="PollForm" >
       <a4j:poll id="poll" interval="100" reRender="counts" />
       </a4j:form>
       </a4j:region>
      
       </f:view>
      


      Bean code

      public class TestBean
      {
      
      
       private int count1 = 0;
       private int count2 = 0;
      
       public void doCount1(ActionEvent event)
       {
       count1++;
       try {
       Thread.sleep((int)(Math.random() * 50));
       } catch (InterruptedException e) {
       e.printStackTrace();
       }
       }
      
       public void doCount2(ActionEvent event)
       {
       count2++;
       try {
       Thread.sleep((int)(Math.random() * 50));
       } catch (InterruptedException e) {
       e.printStackTrace();
       }
       }
      
       public int getCount1()
       {
       return count1;
       }
      
       public int getCount2()
       {
       return count2;
       }
      
      
      }
      
      



        • 1. Re: Ajax queues concurrency woes
          Michael Knapp Newbie

          I'm using Facelets 1.1.14, JSF 1.2_09 and Richfaces 3.3.1 GA

          • 2. Re: Ajax queues concurrency woes
            Nick Belaevski Master

            Hi,

            Your code works ok for me. Can you please check with the latest Facelets (1.1.15B1) and JSF (1.2_13) versions?

            • 3. Re: Ajax queues concurrency woes
              Michael Knapp Newbie

              with JSF 1.2_13 and facelets 1.1.15B1:
              No exceptions anymore, but the one queue or the poll still stops working - counter values are not updated

              I have gone through the call trees with jprofiler, I found out, that the queues in org.ajax4jsf.component.AjaxViewRoot do not receive any events anymore. in broadcastEvents() no events are broadcasted therefore no actionListener is invoked anmorye, thats why the counter stops.

              Actually this problem occured first between Richfaces 3.3.0 BETA2 and 3.3.0 CR2 ... I don't know exactly anymore.

              • 4. Re: Ajax queues concurrency woes
                Michael Knapp Newbie

                The usual pattern of 'break down' I get within two minutes of letting this test code running:
                1) counters not updated anymore
                2) poll reRender stops working
                3) no update at all anymore
                4) application stops with exception


                I have improved the test code a bit

                added to bean code

                 public String getTimestamp()
                 {
                 return "" + System.currentTimeMillis();
                 }
                


                added to jsf code
                 <a4j:outputPanel layout="block" id="count1" >
                 <h:outputText value="Count 1 : #{test.timestamp}" />
                 <br />
                 <h:outputText value="Count 1 : #{test.count1}" />
                 </a4j:outputPanel>
                
                 <a4j:outputPanel layout="block" id="count2" >
                 <h:outputText value="Count 1 : #{test.timestamp}" />
                 <br />
                 <h:outputText value="Count 2 : #{test.count2}" />
                 </a4j:outputPanel>
                
                 <a4j:outputPanel layout="block" id="counts" >
                 <h:outputText value="Count 1 : #{test.timestamp}" />
                 <br />
                 <h:outputText value="Count 1 : #{test.count1}" />
                 <br />
                 <h:outputText value="Count 2 : #{test.count2}" />
                 </a4j:outputPanel>
                






                • 5. Re: Ajax queues concurrency woes
                  Michael Knapp Newbie

                  output from log of that exception

                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseFilter] Filter start request processing at 30.07.09 12:17 for uri: /jbosstest/queuetest.jsf
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseFilter] Incoming request has Content-Type header with character encoding UTF-8
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseFilter] Filter request output to XML
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseXMLFilter] XML filter service start processing request
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseFilter] Filter start request processing at 30.07.09 12:17 for uri: /jbosstest/queuetest.jsf
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseFilter] Not is faces request, Filter perform not-xml parsing chain
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process before phase RESTORE_VIEW 1
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.application.AjaxStateHolder] Request for a view states holder instance
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.component.AjaxRegionBrige] Restore State of UIAjaxComponent with Id _viewRoot
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.component.AjaxRegionBrige] Restore State of UIAjaxComponent with Id j_id2
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.component.AjaxRegionBrige] Restore State of UIAjaxComponent with Id j_id4536
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process after phase RESTORE_VIEW 1
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process before phase APPLY_REQUEST_VALUES 2
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.renderkit.RendererBase] Start decoding of component j_id2 with class org.ajax4jsf.component.html.HtmlAjaxRegion
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.renderkit.AjaxContainerRenderer] Decode ajax request status for j_id2
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.component.AjaxRegionBrige] Submitted AJAX request - Queue Event to AjaxListeners
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.renderkit.RendererBase] Start decoding of component j_id3:j_id6 with class org.ajax4jsf.component.html.HtmlAjaxFunction
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.renderkit.AjaxCommandRendererBase] Decode submit of the Ajax component j_id3:j_id6
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process after phase APPLY_REQUEST_VALUES 2
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process before phase PROCESS_VALIDATIONS 3
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process after phase PROCESS_VALIDATIONS 3
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process before phase UPDATE_MODEL_VALUES 4
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process after phase UPDATE_MODEL_VALUES 4
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process before phase INVOKE_APPLICATION 5
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process after phase INVOKE_APPLICATION 5
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process before phase RENDER_RESPONSE 6
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] PhaseListener enter Before RenderView Phase with ViewId /queuetest.jsf and RenderKitId HTML_BASIC
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.application.AjaxViewHandler] Process AJAX events to calculate areas.
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.component.AjaxRegionBrige] Send Event to AjaxListeners from AjaxContainer with Id j_id2
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.context.AjaxContext] Invoke AjaxRegion Listener for component with Id=j_id6
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.renderkit.AjaxRendererUtils] Calculate absolute ID for component count1 as :j_id3:count1
                  2009-07-30 12:17:24,359 ERROR -> (http-0.0.0.0-8080-2) [STDERR] 30.07.2009 12:17:24 com.sun.facelets.FaceletViewHandler handleRenderException
                  SCHWERWIEGEND: Error Rendering View[/queuetest.jsf]
                  java.lang.ArrayIndexOutOfBoundsException
                  2009-07-30 12:17:24,359 ERROR -> (http-0.0.0.0-8080-2) [javax.enterprise.resource.webcontainer.jsf.lifecycle] JSF1054: (Phase ID: RENDER_RESPONSE 6, View ID: /queuetest.jsf) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@19a1d0e]
                  2009-07-30 12:17:24,359 DEBUG -> (http-0.0.0.0-8080-2) [org.ajax4jsf.event.AjaxPhaseListener] Process after phase RENDER_RESPONSE 6
                  2009-07-30 12:17:24,359 ERROR -> (http-0.0.0.0-8080-2) [org.ajax4jsf.webapp.BaseXMLFilter] Exception in the filter chain
                  javax.servlet.ServletException
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:277)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                   at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                   at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                   at java.lang.Thread.run(Thread.java:619)
                  Caused by: java.lang.ArrayIndexOutOfBoundsException
                  2009-07-30 12:17:24,359 ERROR -> (http-0.0.0.0-8080-2) [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/jbosstest].[facesservlet]] Servlet.service() for servlet facesservlet threw exception
                  java.lang.ArrayIndexOutOfBoundsException
                  


                  • 6. Re: Ajax queues concurrency woes
                    Michael Knapp Newbie

                    even with a simplified jsf code the same pattern of failure occurs, but it takes a bit longer (5-10minutes)


                    <a4j:jsFunction name="doCount1" actionListener="#{test.doCount1}" reRender="count1" ajaxSingle="true" />
                    
                    <a4j:outputPanel layout="block" id="count1" >
                     <h:outputText value="Count 1 : #{test.timestamp}" />
                     <br />
                     <h:outputText value="Count 1 : #{test.count1}" />
                    </a4j:outputPanel>
                    
                    <a4j:outputPanel layout="block" id="counts" >
                     <h:outputText value="Count 1 : #{test.timestamp}" />
                     <br />
                     <h:outputText value="Count 1 : #{test.count1}" />
                    </a4j:outputPanel>
                    
                    <script type="text/javascript" >
                     window.setInterval('doCount1()', 50);
                    </script>
                    
                    
                    


                    Exception
                    12:26:11,890 WARN [lifecycle] JSF1053: (Listener: org.ajax4jsf.event.AjaxPhaseListener.afterPhase(), Phase ID: RESTORE_VIEW 1, View ID: /queuetest2.jsf) Exception thrown during phase-listener execut
                    ion: java.util.ConcurrentModificationException
                    12:26:11,906 WARN [lifecycle] java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
                    java.util.HashMap$KeyIterator.next(HashMap.java:828)
                    org.ajax4jsf.event.AjaxPhaseListener.afterPhase(AjaxPhaseListener.java:79)
                    com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
                    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
                    com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
                    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                    javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
                    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                    org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                    org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                    org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                    org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
                    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                    org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                    org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
                    


                    • 7. Re: Ajax queues concurrency woes
                      Michael Knapp Newbie

                      actually the last tests from tody I have peformed with facelets 1.1.15 B1 and JSF 1.2_13

                      • 8. Re: Ajax queues concurrency woes
                        Michael Knapp Newbie

                        An interesting detail I have found out:

                        I have Dual Core CPU ("Intel Core 2 Duo"). When I assign only one CPU the JVM, the the problem does not occur. When I assign both CPUs again to the JVM, then the problem occurs again in a qute short time (less than one minute)

                        For me it is clear, that there is a concurrency problem in ajax4jsf on
                        Multi-CPU systems.

                        • 9. Re: Ajax queues concurrency woes
                          Nick Belaevski Master

                          Could you be so kind and check this on Tomcat (not JBoss AS)?

                          • 10. Re: Ajax queues concurrency woes
                            Michael Knapp Newbie

                            Now tested with Tomcat 6.0.26: more or less same behavior as in JBoss
                            also in single cpu mode much more stable than in dual cpu mode

                            some log output

                            30.07.2009 17:19:50 org.ajax4jsf.context.AjaxContextImpl convertId
                            WARNUNG: Target component for id count2 not found
                            30.07.2009 17:19:50 org.ajax4jsf.context.AjaxContextImpl convertId
                            WARNUNG: Target component for id count1 not found
                            30.07.2009 17:26:53 com.sun.faces.lifecycle.Phase handleAfterPhase
                            WARNUNG: JSF1053: (Listener: org.ajax4jsf.event.AjaxPhaseListener.afterPhase(), Phase ID: RESTORE_VIEW 1, View ID: /queuetest.jsf) Exception thrown during phase-listener execution: java.util.Concurre
                            30.07.2009 17:26:53 com.sun.faces.lifecycle.Phase handleAfterPhase
                            WARNUNG: java.util.HashMap$HashIterator.nextEntry(HashMap.java:793)
                            java.util.HashMap$KeyIterator.next(HashMap.java:828)
                            org.ajax4jsf.event.AjaxPhaseListener.afterPhase(AjaxPhaseListener.java:79)
                            com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
                            com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
                            com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
                            com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                            javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:510)
                            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                            org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                            org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                            org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                            org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
                            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                            org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
                            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
                            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
                            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
                            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
                            java.lang.Thread.run(Thread.java:619)
                            
                            


                            • 11. Re: Ajax queues concurrency woes
                              Michael Knapp Newbie

                              I've created a version of the test code without facelets and tested it on Tomcat 6.0.26 and JBOSS 4.2.3 GA
                              everthing seems to work now ...

                              hm, seems to be a facelets related problem , not really a ajax4jsf problem.

                              • 12. Re: Ajax queues concurrency woes
                                Michael Knapp Newbie

                                @nick: do you or some of the developers know the faclets code, so that one can give me a hint for the reason of that problem so that we can fix it, as this would be important for all jsf+facelets+richfaces users.

                                • 13. Re: Ajax queues concurrency woes
                                  Nick Belaevski Master

                                  Facelets use component attributes to handle view creation, so in this situation two threads are sharing the same instance of attributes map and that's causing problems. We've created a special context init parameter org.ajax4jsf.SERIALIZE_SERVER_STATE: https://jira.jboss.org/jira/browse/RF-3631 to work around such situations. Can you please try setting this parameter to "true" and check? Also can you please post web.xml file?

                                  • 14. Re: Ajax queues concurrency woes
                                    Michael Knapp Newbie

                                    with org.ajax4jsf.SERIALIZE_SERVER_STATE=true no failure anymore
                                    _BUT_
                                    the counters show some erratic behavior, count backward for one step, slower, faster ... instead of a smooth increase (in booth, single and dual cpu mode)
                                    seems depending on the apache connection threads (named "http-0.0.0.0-8080-1", "http-0.0.0.0-8080-2", .... handling the requests

                                    web.xml

                                    <?xml version="1.0" encoding="UTF-8"?>
                                    
                                    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd" version="2.5">
                                    
                                     <!-- ************************ FACES Config **************************** -->
                                     <context-param>
                                     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                                     <param-value>server</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                                     <param-value>.jsf</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>com.sun.faces.displayConfiguration</param-name>
                                     <param-value>true</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
                                     <param-value>true</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>com.sun.faces.serializeServerState</param-name>
                                     <param-value>false</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>com.sun.faces.compressViewState</param-name>
                                     <param-value>false</param-value>
                                     </context-param>
                                    
                                     <!-- ************************ FACELETS Config **************************** -->
                                     <context-param>
                                     <param-name>facelets.DEVELOPMENT</param-name>
                                     <param-value>false</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>facelets.REFRESH_PERIOD</param-name>
                                     <param-value>-1</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>facelets.VIEW_MAPPINGS</param-name>
                                     <param-value>*.jsf</param-value>
                                     </context-param>
                                    
                                     <!-- ************************ RICHFACES Config **************************** -->
                                    
                                     <context-param>
                                     <param-name>org.richfaces.SKIN</param-name>
                                     <param-value>blueSky</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                                     <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                                     </context-param>
                                     <context-param>
                                     <param-name>org.ajax4jsf.SERIALIZE_SERVER_STATE</param-name>
                                     <param-value>true</param-value>
                                     </context-param>
                                    
                                     <filter>
                                     <display-name>RichFaces Filter</display-name>
                                     <filter-name>richfaces</filter-name>
                                     <filter-class>org.ajax4jsf.Filter</filter-class>
                                     </filter>
                                    
                                     <context-param>
                                     <param-name>org.richfaces.CONTROL_SKINNING</param-name>
                                     <param-value>enable</param-value>
                                     </context-param>
                                    
                                     <filter-mapping>
                                     <filter-name>richfaces</filter-name>
                                     <servlet-name>facesservlet</servlet-name>
                                     <dispatcher>REQUEST</dispatcher>
                                     <dispatcher>FORWARD</dispatcher>
                                     <dispatcher>INCLUDE</dispatcher>
                                     </filter-mapping>
                                    
                                    <filter>
                                     <display-name>RichFaces Filter</display-name>
                                     <filter-name>richfaces</filter-name>
                                     <filter-class>org.ajax4jsf.Filter</filter-class>
                                    </filter>
                                    
                                    <filter-mapping>
                                     <filter-name>richfaces</filter-name>
                                     <servlet-name>facesservlet</servlet-name>
                                     <dispatcher>REQUEST</dispatcher>
                                     <dispatcher>FORWARD</dispatcher>
                                     <dispatcher>INCLUDE</dispatcher>
                                    </filter-mapping>
                                    
                                    <listener>
                                     <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
                                    </listener>
                                    
                                     <!-- Faces Servlet -->
                                    <servlet>
                                     <display-name>Faces Servlet</display-name>
                                     <servlet-name>facesservlet</servlet-name>
                                     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                                     <load-on-startup>1</load-on-startup>
                                    </servlet>
                                    
                                     <!-- Faces Servlet Mapping -->
                                    <servlet-mapping>
                                     <servlet-name>facesservlet</servlet-name>
                                     <url-pattern>*.jsf</url-pattern>
                                    </servlet-mapping>
                                    
                                    
                                     <security-constraint>
                                     <display-name>Security Constraint</display-name>
                                     <web-resource-collection>
                                     <web-resource-name>Other</web-resource-name>
                                     <url-pattern>/*</url-pattern>
                                     <http-method>GET</http-method>
                                     <http-method>POST</http-method>
                                     <http-method>PUT</http-method>
                                     </web-resource-collection>
                                     <user-data-constraint>
                                     <transport-guarantee>NONE</transport-guarantee>
                                     </user-data-constraint>
                                     </security-constraint>
                                    
                                    
                                    </web-app>
                                    


                                    faces-config.xml

                                    <?xml version="1.0" encoding="UTF-8"?>
                                    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
                                    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
                                    <faces-config>
                                    
                                     <application>
                                     <locale-config>
                                     <default-locale>en</default-locale>
                                     <supported-locale>de</supported-locale>
                                     <supported-locale>en</supported-locale>
                                     </locale-config>
                                     </application>
                                    
                                     <managed-bean>
                                     <managed-bean-name>test</managed-bean-name>
                                     <managed-bean-class>test.TestBean</managed-bean-class>
                                     <managed-bean-scope>request</managed-bean-scope>
                                     </managed-bean>
                                    
                                    </faces-config


                                    1 2 Previous Next