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 15:39:02 UTC

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

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



##########
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:
       Also affects jetty 9.x too.
   
   The issue is not as bad for me as it just causes log spam because exceptions thrown by the listener are caught and logged by jetty... but I thought better to create a PR to at least hint... Ain't nobody got time for JIRA




-- 
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