[seam-dev] session invalidation problem

Dan Allen dan.j.allen at gmail.com
Mon Apr 21 14:48:10 EDT 2008


To prove that I am not completely losing my marbles, I was able to
reproduce this problem using the Tomcat JPA example...and here are my
findings:

After some research, I have reached the root of the problem. First,
this only happens when you deploy to Tomcat (I tested the Tomcat 6.0.X
series). The problem occurs when you invoke the method binding
expression #{session.invalidate} from a UI command button. Although
Seam has a component named "session", the session that is actually
resolved is the org.apache.catalina.session.StandardSessionFacade, the
implementation of HttpSession. Seam yells at you not to interact with
invalidate() method on this API directly. The proper way to invalidate
the session would be to call #{org.jboss.seam.web.session.invalidate}.

I verified that the explosion of sessions occurs using the Tomcat JPA
example under the examples directory. <s:link
action="#{session.invalidate}" value="Invalidate Session (with
HttpSession)"/>. The problem does not occur when using <s:link
action="#{org.jboss.seam.web.session.invalidate}" value="Invalidate
Session (with Seam)"/>

I don't understand why this happens on Tomcat and not JBoss AS.
Theoretically, there is nothing we can do about it since we cannot
stop the HttpSession#invalidate() method from being invoked. Perhaps a
better solution is to use a different name (or alias) for the Seam
session wrapper so that people don't mistakenly think they are using
it when in fact they are interacting with the implicit session EL
variable.

On Mon, Apr 14, 2008 at 2:42 AM, Dan Allen <dan.j.allen at gmail.com> wrote:
> One thing led to another last week and I never got to reporting this
>  issue. I finally got around to it:
>
>  http://jira.jboss.org/jira/browse/JBSEAM-2888
>
>
>
>  On Thu, Apr 10, 2008 at 1:30 PM, Pete Muir <pmuir at bleepbleep.org.uk> wrote:
>  > Please report in JIRA with reproduction steps :-)
>  >
>  >
>  >
>  >  On 10 Apr 2008, at 18:13, Dan Allen wrote:
>  >
>  > >
>  > >
>  > >
>  > > I was doing some session size research today in my application and I
>  > > uncovered what appears to be a pretty nasty bug in Seam during the
>  > > post-session invalidation routine. If you call #{session.invalidate}
>  > > (which is also called by #{identity.logout} it leads to an *explosion*
>  > > of sessions. (~50)
>  > >
>  > > To observe this behavior, install a servlet context listener that
>  > > watches for session creation. Then run one of these two action
>  > > listener methods. You can run Thread.dumpStack() in the listener to
>  > > see that it is happening as a result of attribute reads on the
>  > > ServerConversationContext. I guess because the session was
>  > > invalidated, Seam attempts to recreate the session over and over as it
>  > > works with the conversation within that request.
>  > >
>  > > -Dan
>  > >
>  > > -- Dan Allen
>  > > Software consultant | Author of Seam in Action
>  > >
>  > > http://www.mojavelinux.com
>  > > http://manning.com/dallen
>  > >
>  > > NOTE: While I make a strong effort to keep up with my email on a daily
>  > > basis, life and work come first and, at times, keep me away from my mail
>  > > for a while. If you contact me, then don't hear back for more than a week,
>  > > it is very likely that I am excessively backlogged or the message was
>  > > caught in the spam filters. Please don't hesitate to resend a message if
>  > > you feel that it did not reach my attention.
>  > > _______________________________________________
>  > > seam-dev mailing list
>  > > seam-dev at lists.jboss.org
>  > > https://lists.jboss.org/mailman/listinfo/seam-dev
>  > >
>  >
>  >
>
>
>
>  --
>  Dan Allen
>  Software consultant | Author of Seam in Action
>
>  http://www.mojavelinux.com
>  http://manning.com/dallen
>
>  NOTE: While I make a strong effort to keep up with my email on a daily
>  basis, life and work come first and, at times, keep me away from my mail
>  for a while. If you contact me, then don't hear back for more than a week,
>  it is very likely that I am excessively backlogged or the message was
>  caught in the spam filters. Please don't hesitate to resend a message if
>  you feel that it did not reach my attention.
>



-- 
Dan Allen
Software consultant | Author of Seam in Action

http://www.mojavelinux.com
http://manning.com/dallen

NOTE: While I make a strong effort to keep up with my email on a daily
basis, life and work come first and, at times, keep me away from my mail
for a while. If you contact me, then don't hear back for more than a week,
it is very likely that I am excessively backlogged or the message was
caught in the spam filters.  Please don't hesitate to resend a message if
you feel that it did not reach my attention.



More information about the seam-dev mailing list