voyent
Seam, IntervalRender and SessionExpiredException  XML
Forum Index -> JBoss Seam Integration
Author Message
bnsbr

Joined: 19/Oct/2009 00:00:00
Messages: 9
Offline


Hi everybody, I'm building one Icefaces application (v1.8.2) with ajax push using the interval render.

When I deployed the application on the pre-production enviroment I receveid one message from the QA team telling about problems with Session Expired messages.

Looking at the log I was surprised to see that there were 40.000 Threads Stack Traces with the SessionExpiredException on they.

Looking at the code it seems that the Interval Render is creating threads to update pages (views) from users that have they session expired. Analysing more I saw that RunnableRender.run have one method (testSession) that is executed only for seam enviroments and that this method trys to call Session.getAttributes(). But the Session object is one ProxyHttpSession from Icefaces that catch the original IllegalStateException (for which the run method have one catch block) and wrap it into one SessionExpiredException that is not expected int the run method. This cause the Thread to die with this exception.

Can I classify this as a Icefaces Bug?

Have anyone faced this problem?

Enviroment: JBoss Seam 2.2.0; Icefaces 1.8.2; Tomcat 6.0.29 / Weblogic 10.3.2

Thanks in advance,
Bruno.

PS: Just want to know, there will be one 1.8.3 release of icefaces?
ted.goddard

Joined: 26/Oct/2004 00:00:00
Messages: 874
Offline


Logging must be configured in such a way that an uncaught RuntimeException that causes the Thread to exit is logged. This could be considered a bug, so please create a JIRA.
[Email]
paul.mooney

Joined: 03/Oct/2008 00:00:00
Messages: 12
Offline


This is an old thread but I don't see a Jira and I'm having this problem too.

Was there any resolution?

I get the exception:

Code:
 Exception in thread "Render Thread - 3024" com.icesoft.faces.webapp.http.core.SessionExpiredException: User session has
 expired or it was invalidated.
         at com.icesoft.faces.webapp.http.servlet.ProxyHttpSession.getAttributeNames(ProxyHttpSession.java:93)
         at com.icesoft.faces.async.render.RunnableRender.testSession(RunnableRender.java:186)
         at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:135)
         at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
 
         at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
         at java.lang.Thread.run(Thread.java:619)
 Caused by: java.lang.IllegalStateException: HttpSession is invalid
         at weblogic.servlet.internal.session.SessionData.getAttributeNames(SessionData.java:459)
         at com.icesoft.faces.webapp.http.servlet.ProxyHttpSession.getAttributeNames(ProxyHttpSession.java:91)
         ... 5 more
 


It looks like this exception occurs at the same interval I've set the interval renderer for.

My guess is that my Seam page scoped bean @Destroy lifecycle callback that leaves the render group doesn't get called correctly when the session expires. I will have to investigate more when I get the chance, unless someone else has any ideas?

Code:
    @Destroy
     public void dispose() {
         leaveRenderGroups();
     }
     
    public void leaveRenderGroups() {
         leaveRenderGroup(intervalRenderer);
         leaveRenderGroup(onDemandRenderer);
     }
 
    public void leaveRenderGroup(GroupAsyncRenderer renderer) {
         
         if (renderer!=null) {
             logger.debug("Removing instance of #0 from renderer #1",this.getClass().getSimpleName(),renderer.getName());
             renderer.remove(this);
             if (renderer.isEmpty()) {
                 renderer.requestStop();
             }
         }
     }
 
paul.mooney

Joined: 03/Oct/2008 00:00:00
Messages: 12
Offline


I was right. Session expiration does not cause the Destroy life cycle methods on Page scope beans to be called, so they don't leave the interval render group.

My workaround was to create a session scoped 'registry' bean which page scoped beans relying on the interval renderer register themselves with upon creation, and deregister from when they are destroyed.

When the session expires, the Destroy method is called on the 'registry' bean, which iterates over any remaining page scoped beans it has a reference to and forces them to leave their render groups.

It's a hack, but it gets around the lack of lifecycle callback for lesser than session scope beans when the session expires.
judy.guglielmin

Joined: 20/Feb/2007 00:00:00
Messages: 1396
Offline


If I remember correctly, there were a few problems along this line with the management of Page scoped beans and Seam 2 (I don't believe there is a Page scope in Seam 3, but I haven't looked at it lately). Since Seam interceptors manage the Page scoped objects, that would be something probably to do with Seam (unless you can create a non-ICEfaces case which behaves differently and then we should be taking a look at it).
If you want to pursue this in greater depth, that would be a recommendation.
paul.mooney

Joined: 03/Oct/2008 00:00:00
Messages: 12
Offline


Yes this is ultimately IMO a Seam issue.

From an Icefaces perspective there could be some kind of handling when attempting to push render to expired sessions, and consequently evicting related components from the Renderer, but that's probably a band-aid solution.
 
Forum Index -> JBoss Seam Integration
Go to:   
Powered by JForum 2.1.7ice © JForum Team