You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by GitBox <gi...@apache.org> on 2021/05/13 13:58:12 UTC

[GitHub] [openwebbeans] rmannibucau commented on a change in pull request #34: Workaround Jetty ISE for invalidating sessions

rmannibucau commented on a change in pull request #34:
URL: https://github.com/apache/openwebbeans/pull/34#discussion_r631830461



##########
File path: webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
##########
@@ -593,9 +593,17 @@ protected boolean sessionIsExpiring(HttpSession session)
         int maxInactiveInterval = session.getMaxInactiveInterval();
         if (maxInactiveInterval > 0)
         {
-            long inactiveSince = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - session.getLastAccessedTime());
-            if (inactiveSince >= maxInactiveInterval)
+            try 
             {
+                long inactiveSince = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - session.getLastAccessedTime());
+                if (inactiveSince >= maxInactiveInterval)
+                {
+                    return true;
+                }
+            }
+            catch (IllegalStateException e) 
+            {
+                // Jetty will throw an ISE if you attempt to query the last accessed time of a session that is being invalidated
                 return true;

Review comment:
       Hi @stephenc , we discussed it with @tandraschko and I think if it is, it must be in jetty module and it should likely be sortable without such a hack by adjusting the position of the listeners. By spec this must not happen (servlet spec) and session must not be invalidated before the listener is called so getLastAccessedTime is a valid call.
   My main concern is this workaround hides actual bugs and wrong setups which shouldn't be. If jetty bug is not quickly fix we can detect jetty version in jetty module and wrap the listener to catch it but probably not in web module.
   
   wdyt?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org