1 Reply Latest reply on Jan 26, 2010 8:41 PM by Arbi Sookazian

    ConcurrentRequestTimeoutException

    Arbi Sookazian Master

      Seam 2.1.1.GA


      I'm getting this in a page with a couple of a4j:support tags configured as such:


      <h:inputText id="baseQualifiedPercent"
                                  disabled="#{pageaction == 'view'}"
                                  styleClass="percentField"
                                  required="true"
                                  onkeypress="return restrictDecIntegersOrFormatNum(this, event, 0, 0.99, 2);"
                                  onfocus="javascript:clearZeroes(this);"
                                  maxlength="4"
                                  value="#{merchantBillingGroupEditorUI.percent}"
                                  label="#{messages['/restricted/billing/add_merchant_billing_group_wizard_step1.xhtml/field.percent']}">
                                  <a4j:support event="onblur"
                                                 ajaxSingle="true"
                                                onsubmit="javascript:format_num(this, 0, 9.99, 2);"
                                                requestDelay="200"
                                                eventsQueue="select"
                                                ignoreDupResponses="true"
                                                reRender="baseQualifiedEffectiveDate"/> 
                              </h:inputText>



      <core:manager conversation-timeout="120000"
                concurrent-request-timeout="2000" conversation-id-parameter="cid" />



      11:23:03,333 WARN  [SeamPhaseListener] uncaught exception, passing to exception handler
      org.jboss.seam.ConcurrentRequestTimeoutException: Concurrent call to conversation
           at org.jboss.seam.core.Manager.restoreAndLockConversation(Manager.java:641)
           at org.jboss.seam.core.Manager.restoreConversation(Manager.java:603)
           at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:390)
           at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:228)
           at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:194)
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
           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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
           at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           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.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
           at com.echo.cis.web.filters.TimingFilter.doFilter(TimingFilter.java:61)
           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:179)
           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:595)



      How to prevent this exception??

        • 1. Re: ConcurrentRequestTimeoutException
          Arbi Sookazian Master

          from Seam Manager component:


          private boolean restoreAndLockConversation(ConversationEntry ce)
             {
                if (ce == null)
                {
                   //there was no id in either place, so there is no
                   //long-running conversation to restore
                   log.debug("No stored conversation");
                   initializeTemporaryConversation();
                   return false;
                }
                else if ( ce.lock() )
                {
                   // do this ASAP, since there is a window where conversationTimeout() might  
                   // try to destroy the conversation, even if he cannot obtain the lock!
                   touchConversationStack( ce.getConversationIdStack() );
          
                   //we found an id and obtained the lock, so restore the long-running conversation
                   log.debug("Restoring conversation with id: " + ce.getId());
                   setLongRunningConversation(true);
                   setCurrentConversationId( ce.getId() );
                   setCurrentConversationIdStack( ce.getConversationIdStack() );
          
                   boolean removeAfterRedirect = ce.isRemoveAfterRedirect() && !Pages.isDebugPage(); //TODO: hard dependency to JSF!!
                   if (removeAfterRedirect)
                   {
                      setLongRunningConversation(false);
                      ce.setRemoveAfterRedirect(false);
                   }
                   
                   return true;
          
                } 
                else
                {
                   log.debug("Concurrent call to conversation");
                   throw new ConcurrentRequestTimeoutException("Concurrent call to conversation");
                }
             }
          



          from ConversationEntry class:


          public boolean lock() //not synchronized!
             {
                try
                {
                   return lock.tryLock( getConcurrentRequestTimeout(), TimeUnit.MILLISECONDS );
                }
                catch (InterruptedException ie)
                {
                   throw new RuntimeException(ie);
                }
             }
             




          A ReentrantLock is owned by the thread last successfully locking, but not yet unlocking it. A thread invoking lock will return, successfully acquiring the lock, when the lock is not owned by another thread. The method will return immediately if the current thread already owns the lock.

          http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/locks/ReentrantLock.html#tryLock%28long,%20java.util.concurrent.TimeUnit%29


          So basically the current LRC is locked by another thread (possibly an AJAX request form submission?) and the timeout is apparently not long enough so the lock is rejected for the new thread.


          So isn't 2000ms long enough for concurrent-request-timeout in components.xml?  In previous apps it seemed to be sufficient.