9 Replies Latest reply on Nov 13, 2009 5:46 PM by peyman

    Weird Converasation Behaviour (timeout related?)

    frer

      Hi,


      I have a weird conversation behaviour which I cannot explain.  I have read many posts and documentation on conversation timeout (background and foreground) but don't seem to understand what is happening in my particular case.


      I have a form which is linked to a stateful conversation scope bean (which will call a few other beans with conversation scope). 


      The exact behaviour is hard to explain but I'll do my best:


      In my form if I perform the following:




      • I interact with my foreground conversation and let the window still for 10 minutes

      • After the 10 minutes I interact with it again (validating an input field for example)





      For a reason I do not understand, the form does not react as expected. For example when I click a a4j:commandButton, it should add a field to my list of fields...it doesn't do it anymore.  My form just won't react as it used to.


      If I do the exact same steps, but for less than 10 minutes, everything is fine (i.e. the form reacts normally).


      My converstaion timeout is set to 15 minutes and my session timeout is set to 12 hours.  I don't think its either of them interacting here since my session seems to be still valid and I don't interact with the application in any other way (so I'm still in my foreground conversation).



      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
          xmlns:core="http://jboss.com/products/seam/core"
          xmlns:persistence="http://jboss.com/products/seam/persistence"
          xmlns:drools="http://jboss.com/products/seam/drools"
          xmlns:bpm="http://jboss.com/products/seam/bpm"
          xmlns:security="http://jboss.com/products/seam/security"
          xmlns:mail="http://jboss.com/products/seam/mail"
          xmlns:ui="http://jboss.com/products/seam/ui"
          xmlns:web="http://jboss.com/products/seam/web"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:navigation="http://jboss.com/products/seam/navigation"
          xmlns:async="http://jboss.com/products/seam/async"    
          xmlns:transaction="http://jboss.com/products/seam/transaction"
          xsi:schemaLocation="http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd 
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.2.xsd 
                       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.2.xsd
                       http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.2.xsd
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.2.xsd
                       http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.2.xsd
                       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.2.xsd
                       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.2.xsd
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd
                       http://jboss.com/products/seam/navigation http://jboss.com/products/seam/navigation-2.2.xsd">
      
      <!-- 
          <web:character-encoding-filter encoding="UTF-8" override-client="true" url-pattern="*.do" />/>
       -->
       
          <!-- ***************** -->
          <!-- ***************** -->
          <!-- GENERAL SETUP -->                  
          <!-- ***************** -->
          <!-- ***************** -->
          <core:manager conversation-timeout="900000" 
                        concurrent-request-timeout="5000"
                        conversation-id-parameter="cid"/>
      
          <core:init jndi-pattern="totaltest/#{ejbName}/local" debug="true"/>
      
           <navigation:pages>
               <navigation:resources>
                   <value>/WEB-INF/pages.xml</value>
                   <value>/WEB-INF/pages-custom.xml</value>
               </navigation:resources>
           </navigation:pages>
      
          <!-- ***************** -->
          <!-- ***************** -->
          <!-- RESOURCES SETUP -->                  
          <!-- ***************** -->
          <!-- ***************** -->
          <core:resource-loader>
              <core:bundle-names>
                  <value>messages</value>
                  <value>messages-custom</value>       
              </core:bundle-names>
          </core:resource-loader>
          
          
          <!-- ***************** -->
          <!-- ***************** -->
          <!-- HIBERNATE SETUP -->                  
          <!-- ***************** -->
          <!-- ***************** -->
          <persistence:hibernate-session-factory name="hibernateSessionFactory" cfg-resource-name="hibernate.cfg.xml" auto-create="true" />
          <persistence:managed-hibernate-session name="persistenceSession" auto-create="true" session-factory="#{hibernateSessionFactory}" />
          
          <persistence:hibernate-session-factory name="hibernateMigrationSessionFactory"  cfg-resource-name="hibernate.migration.cfg.xml" auto-create="true" />
          <persistence:managed-hibernate-session name="migrationPersistenceSession" auto-create="true" session-factory="#{hibernateMigrationSessionFactory}"/>
      
          <transaction:hibernate-transaction session="#{persistenceSession}" auto-create="true"/>    
          <ui:hibernate-entity-loader session="#{persistenceSession}" />
       
          <!-- ***************** -->
          <!-- ***************** -->
          <!-- NAVIGATION SETUP -->                  
          <!-- ***************** -->
          <!-- ***************** -->
          <security:identity authenticate-method="#{authenticator.authenticate}"/>
            
          <event type="org.jboss.seam.security.notLoggedIn">
              <action execute="#{redirect.captureCurrentView}" />
          </event>
          <factory name="currentSession" scope="stateless" value="#{facesContext.externalContext.request.session}"/> 
          <event type="org.jboss.seam.security.loginSuccessful">
              <action execute="#{redirect.returnToCapturedView}" />
              <action execute="#{currentSession.setMaxInactiveInterval(43200)}"/>
          </event>
          <mail:mail-session host="localhost" port="2525" username="test" password="test" />
      
          <!-- ***************** -->
          <!-- ***************** -->
          <!-- COMPONENTS SETUP -->                  
          <!-- ***************** -->
          <!-- ***************** -->
          <factory name="localizationContext" method="#{localizationFacade.getLocalizationContext}" auto-create="true"/>
      
          <async:quartz-dispatcher/>
      </components>
      



      Any idea what seems to be the problem?  I'm thinking something's timing out somewhere but I'm not sure what it could be.


      Thanks

        • 1. Re: Weird Converasation Behaviour (timeout related?)
          jeanluc

          Try enabling DEBUG or more detailed logging for Seam and JSF packages, perhaps something in the logs will provide a clue.

          • 2. Re: Weird Converasation Behaviour (timeout related?)
            frer

            I went a step further and debugged the beans (after the 10 minute period) and they are still alive and in an ok state. 


            But the form does not react anymore.  For example, I can see that my rich:dataTable calls a method from my bean to get its list.  The list returns 10 items but only 2 elements are displayed.


            Can something timeout at the front end?  Could my form have timed out?

            • 3. Re: Weird Converasation Behaviour (timeout related?)
              frer

              Ok Jean-Luc. 


              I will look into logging with seam and jsf/richfaces.  I haven't done it before so as soon as I figure out how, I will post any logging information that could help figure out what the problem is.

              • 4. Re: Weird Converasation Behaviour (timeout related?)
                frer

                By debugging some more (with logs and seam debug) I realized what the problem is...although I do not know how to correct it.


                It seems that I have an entity that loses its reference when referenced in 2 different backing beans.


                Here is an example to explain what I mean:



                • I have 2 backing beans (ActionA and ActionB) that interact with my form. 

                • Both backing beans, interact with an entity bean (EntityA). 

                • EntityA is kept as a protected variable in both ActionA and ActionB.

                • ActionA actually creates EntityA and then creates ActionB passing the EntityA in the constructor (therefore ActionB uses the same reference as ActionA)



                Now this works fine when not letting the app sleep for 10 minutes (the reference is the same in bothe ActionA and ActionB) but after 10 minutes, the reference is different (i.e. If I modify EntityA in ActionA it will not modify the EntityA in ActionB).


                Why is that?  Seems like some sort of serialization process of the objects...


                Would you know what and who is causing this?  Hibernate? Jboss?

                • 5. Re: Weird Converasation Behaviour (timeout related?)

                  Maybe the underlying cause is similar to what happens in JBSEAM-3493

                  • 6. Re: Weird Converasation Behaviour (timeout related?)
                    frer

                    I actually figured out that the problem came from EJB passivation.  The SFSB I use gets passivated after 10 minutes.  I tried mofifying this by adding this line to my SFSF:


                    @CacheConfig(idleTimeoutSeconds=0)
                    



                    but to no avail.  The bean still gets passivated.  I also tried setting the value to 60 seconds bug again whatever I put in the CacheConfig seems to be ignored.


                    I even tried to modify the ejb3-interceptors-aop.xml


                    to set this:


                    <annotation expr="!class(@org.jboss.annotation.ejb.cache.Cache) AND !class(@org.jboss.annotation.ejb.Clustered)">
                       @org.jboss.annotation.ejb.cache.Cache (org.jboss.ejb3.cache.NoPassivationCache.class)
                    </annotation>
                    



                    but again my modifications have no effet.


                    Anyone know why I'm not able to set the passivation timeout (or disable it)?  This would definetely solve my problem.


                    Thanks

                    • 7. Re: Weird Converasation Behaviour (timeout related?)
                      jkronegg

                      There is probably another timeout somewhere. Maybe a transaction timeout?

                      • 8. Re: Weird Converasation Behaviour (timeout related?)
                        frer

                        I'm not sure its a transaction timeout since I have added logs to @PrePassivate and @PostActivate methods and they are the ones being called after my 10 minute period.


                        This is also how I have so far managed to workaround my problem.  In the @PostActivate method, I re-set the reference of the objects (in my example, ActionA's postActivate method sets ActionB's entity to EntityA).


                        This way I work around the problem...ideally I would change the Cache to NoPassivationCache but I'm not able to do this.


                        Any ideas why I'm not able to modify my cache settings?


                        Francois

                        • 9. Re: Weird Converasation Behaviour (timeout related?)
                          peyman

                          I have the same problem. Does anybody have a solution now??


                          Peyman