Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-10500

Conversation after @End method process does not release ConversationEntry lock

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Major Major
    • TBD EAP 5
    • EAP_EWP 5.1.2
    • Seam2
    • None
    • Hide

      Use seam example : <seam examples>/seamspace

      1. Set 60 sec to the concurrent-request-timeout in components.xml.

      <seam examples>/seamspace/resources/WEB-INF/components.xml
      19:    <core:manager conversation-timeout="120000" 
      20:                  concurrent-request-timeout="60000"
      21:                 conversation-id-parameter="cid"/>
      

      2. Add a sleep process to ProfileAction.getMemberBlogs() method.

      <seam examples>/seamspace/src/org/jboss/seam/example/seamspace/ProfileAction.java
      77:  /**
      78:    * Used to read all blog entries for a member
      79:    */
      80:   @SuppressWarnings("unchecked")
      81:   @Factory("memberBlogs")
      82:   public void getMemberBlogs()
      83:   {
      +      try{
      +         System.out.println("-- sleep start");
      +         Thread.sleep(10000L);
      +         System.out.println("-- sleep end");
      +        }catch(Exception e){}
      84:     if (name == null && authenticatedMember != null)
      85:      {
      86:         name = authenticatedMember.getMemberName();
      87:      }
      88:
      89:      memberBlogs = entityManager.createQuery(
      90:            "from MemberBlog b where b.member.memberName = :memberName order by b.entryDate desc")
      91:            .setParameter("memberName", name)
      92:            .getResultList();
      93:   }
      

      3. Execute 'ant deploy' command on the <seam examples>/seamspace directory.
      4. Start EAP server.
      5. Move to 'http://localhost:8080/seam-space/home.seam' with web browser.
      6. Login (demo/demo) -> [Create new blog entry]
      7. Push the [Add entry] button (You can confirm '-- sleep start' message on stdout) and push the F5 button immediately.
      8. You can confirm waiting of the F5 request[1] even if a sleep process has completed and occurring exception[2] after the concurrent-request-timeout.

      [1]
      "http-127.0.0.1-8080-6" daemon prio=10 tid=0x00007f330800a800 nid=0x2b1c waiting on condition [0x00007f32ff71f000]
         java.lang.Thread.State: TIMED_WAITING (parking)
              at sun.misc.Unsafe.park(Native Method)
              - parking to wait for  <0x00000000ee3ee4f0> (a java.util.concurrent.locks.ReentrantLock$FairSync)
              at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
              at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireNanos(AbstractQueuedSynchronizer.java:905)
              at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireNanos(AbstractQueuedSynchronizer.java:1224)
              at java.util.concurrent.locks.ReentrantLock.tryLock(ReentrantLock.java:416)
              at org.jboss.seam.core.ConversationEntry.lock(ConversationEntry.java:221)
              at org.jboss.seam.core.Manager.restoreAndLockConversation(Manager.java:616)
              at org.jboss.seam.core.Manager.restoreConversation(Manager.java:603)
              at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:392)
              at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
              at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196)
              at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
              at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
              at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
              at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:295)
              at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:373)
              at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500)
              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:60)
              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 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:235)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
              at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
              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:158)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.internalProcess(ActiveRequestResponseCacheValve.java:74)
              at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)
              at java.lang.Thread.run(Thread.java:662)
      
      [2]
      11:36:25,106 INFO  [STDOUT] -- sleep start
      11:36:35,107 INFO  [STDOUT] -- sleep end
      11:37:26,420 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:392)
              at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230)
              at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196)
              at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
              at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
      -- snip --
      11:37:26,434 SEVERE [viewhandler] Error Rendering View[/createBlog.xhtml]
      java.lang.IllegalStateException: No active conversation context
              at org.jboss.seam.core.Conversation.instance(Conversation.java:122)
              at org.jboss.seam.ui.component.UIConversationId.getName(UIConversationId.java:44)
              at org.jboss.seam.ui.util.ViewUrlBuilder.addParameter(ViewUrlBuilder.java:42)
              at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:85)
              at org.jboss.seam.ui.renderkit.LinkRendererBase.doEncodeBegin(LinkRendererBase.java:26)
              at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79)
      -- snip --
      
      Show
      Use seam example : <seam examples>/seamspace 1. Set 60 sec to the concurrent-request-timeout in components.xml. <seam examples>/seamspace/resources/WEB-INF/components.xml 19: <core:manager conversation-timeout="120000" 20: concurrent-request-timeout="60000" 21: conversation-id-parameter="cid"/> 2. Add a sleep process to ProfileAction.getMemberBlogs() method. <seam examples>/seamspace/src/org/jboss/seam/example/seamspace/ProfileAction.java 77: /** 78: * Used to read all blog entries for a member 79: */ 80: @SuppressWarnings("unchecked") 81: @Factory("memberBlogs") 82: public void getMemberBlogs() 83: { + try{ + System.out.println("-- sleep start"); + Thread.sleep(10000L); + System.out.println("-- sleep end"); + }catch(Exception e){} 84: if (name == null && authenticatedMember != null) 85: { 86: name = authenticatedMember.getMemberName(); 87: } 88: 89: memberBlogs = entityManager.createQuery( 90: "from MemberBlog b where b.member.memberName = :memberName order by b.entryDate desc") 91: .setParameter("memberName", name) 92: .getResultList(); 93: } 3. Execute 'ant deploy' command on the <seam examples>/seamspace directory. 4. Start EAP server. 5. Move to 'http://localhost:8080/seam-space/home.seam' with web browser. 6. Login (demo/demo) -> [Create new blog entry] 7. Push the [Add entry] button (You can confirm '-- sleep start' message on stdout) and push the F5 button immediately. 8. You can confirm waiting of the F5 request [1] even if a sleep process has completed and occurring exception [2] after the concurrent-request-timeout. [1] "http-127.0.0.1-8080-6" daemon prio=10 tid=0x00007f330800a800 nid=0x2b1c waiting on condition [0x00007f32ff71f000] java.lang.Thread.State: TIMED_WAITING (parking) at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000000ee3ee4f0> (a java.util.concurrent.locks.ReentrantLock$FairSync) at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198) at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireNanos(AbstractQueuedSynchronizer.java:905) at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireNanos(AbstractQueuedSynchronizer.java:1224) at java.util.concurrent.locks.ReentrantLock.tryLock(ReentrantLock.java:416) at org.jboss.seam.core.ConversationEntry.lock(ConversationEntry.java:221) at org.jboss.seam.core.Manager.restoreAndLockConversation(Manager.java:616) at org.jboss.seam.core.Manager.restoreConversation(Manager.java:603) at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:392) at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230) at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196) at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:295) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:373) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:500) 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:60) 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 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:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) 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:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.internalProcess(ActiveRequestResponseCacheValve.java:74) at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:47) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:599) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451) at java.lang.Thread.run(Thread.java:662) [2] 11:36:25,106 INFO [STDOUT] -- sleep start 11:36:35,107 INFO [STDOUT] -- sleep end 11:37:26,420 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:392) at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:230) at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:196) at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114) at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) -- snip -- 11:37:26,434 SEVERE [viewhandler] Error Rendering View[/createBlog.xhtml] java.lang.IllegalStateException: No active conversation context at org.jboss.seam.core.Conversation.instance(Conversation.java:122) at org.jboss.seam.ui.component.UIConversationId.getName(UIConversationId.java:44) at org.jboss.seam.ui.util.ViewUrlBuilder.addParameter(ViewUrlBuilder.java:42) at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:85) at org.jboss.seam.ui.renderkit.LinkRendererBase.doEncodeBegin(LinkRendererBase.java:26) at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79) -- snip --
    • Release Notes
    • Hide
      Seam doesn't properly unlock conversations after they have been terminated with an @End method. This might cause problems in specific cases of concurrent requests to the same conversation, which might lead to exceptions including ConcurrentRequestTimeoutException or ConcurrentModificationException.
      Show
      Seam doesn't properly unlock conversations after they have been terminated with an @End method. This might cause problems in specific cases of concurrent requests to the same conversation, which might lead to exceptions including ConcurrentRequestTimeoutException or ConcurrentModificationException.
    • Not Yet Documented
    • NEW

      ConversationEntry after @End method process is removed by endRequest[1] process and does not release lock. Therefore, when there is a request duplicate with the same Conversation ID by F5 operation etc, since a lock is not released, the request has to wait till the concurrent-request-timeout even if pre-request is already completed.

      [1] org.jboss.seam.core.Manager.java
      441:   /**
      442:    * Touch the conversation stack, destroy ended conversations, 
      443:    * and timeout inactive conversations.
      444:    */
      445:   public void endRequest(Map<String, Object> session)
      446:   {
      447:      if ( isLongRunningConversation() )
      448:      {
      449:         if ( log.isDebugEnabled() )
      450:         {
      451:            log.debug("Storing conversation state: " + getCurrentConversationId());
      452:         }
      453:         touchConversationStack( getCurrentConversationIdStack() );
      454:      }
      455:      else
      456:      {
      457:         if ( log.isDebugEnabled() )
      458:         {
      459:            log.debug("Discarding conversation state: " + getCurrentConversationId());
      460:         }
      461:         //now safe to remove the entry
      => 462:         removeCurrentConversationAndDestroyNestedContexts(session);
      463:      }
      464:
      465:      /*if ( !Init.instance().isClientSideConversations() ) 
      466:      {*/
      467:         // difficult question: is it really safe to do this here?
      468:         // right now we do have to do it after committing the Seam
      469:         // transaction because we can't close EMs inside a txn
      470:         // (this might be a bug in HEM)
      471:         Manager.instance().conversationTimeout(session);
      472:      //}
      473:   }
      

              mnovotny@redhat.com Marek Novotny
              rhn-support-enagai Eiichi Nagai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: