users@glassfish.java.net

Session invalidation / threading issue

From: <glassfish_at_javadesktop.org>
Date: Sun, 01 Mar 2009 12:31:41 PST

I'm encountering a strange problem with Internet Explorer 8, Tapestry 4.1 and Glassfish 2 update 2.

The problem is as follows: I have a web application based on Tapestry. In Tapestry, similar to JSF, all pages are rendered through a common application servlet, in this case mapped as /app/go. The default page is the menu page, but if there is no authenticated user on the HTTP session the login page is shown instead. The menu page has a logout link on it. This link invokes Tapestry's "restart" service. This service invalidates the HTTP session and sends back a redirect to the main app servlet (/app/go), which should then display the login page since there is no HTTP session anymore.

What's happening with Internet Explorer is that when users click on the logout link, the menu page is displayed again instead of the login page.

At first I thought it might be a caching issue, but when I investigated further using a packet sniffer I discovered that Glassfish was really sending the menu page to the browser, which should be impossible since at that point there should be no HTTP session anymore! And indeed, if users refresh the page, they do get the login page.

With this packet sniffer I discovered that Internet Explorer uses different connections to handle the logout. When the logout link is clicked, the request and subsequent 302 response from Tapestry are sent and received on one connection. But the subsequent request for /app/go is sent on a different connection.

This makes me wonder whether it is possible that when a session is invalidated in Glassfish, this is not immediately communicated to all other threads? Is it possible that while on the the original request thread the session has been invalidated, because IE sends the second request very quickly on a different connection, that request thread does not yet know the session has been invalidated, perhaps due to a lack of synchronization?

I hope someone can shed light on this problem. I'll be happy to provide more information to help understand the problem. Many thanks in advance to anyone who can help!

Kind regards,
Pepijn Schmitz
[Message sent by forum member 'pepijn_schmitz' (pepijn_schmitz)]

http://forums.java.net/jive/thread.jspa?messageID=334475