Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-512

Race condition in Shiro's web container session timeout handling

Agile BoardAttach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    Description

      I cannot find anywhere that Shiro uses HttpSessionListener to trap sessionDestroyed event from the container.
      I believe this is leading to a rare race condition in my application, as Shiro thinks the session is still active,
      but in reality, the web session has been destroyed.

      Code: SecurityUtils.getSubject().getPrincipal();

      Relevant bit of stack trace:

      Caused by: org.apache.shiro.session.InvalidSessionException: java.lang.IllegalStateException: PWC2778: getAttribute: Session already invalidated
      at org.apache.shiro.web.session.HttpServletSession.getAttribute(HttpServletSession.java:148)
      at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121)
      at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469)
      at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153)
      at org.apache.shiro.subject.support.DelegatingSubject.getPrincipal(DelegatingSubject.java:149)

      Link to the mailing list thread:
      http://shiro-user.582556.n2.nabble.com/Possible-race-condition-in-Shiro-s-web-container-session-timeout-handling-td7580138.html

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            fpapon Francois Papon
            lprimak Lenny Primak
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0h
              0h
              Logged:
              Time Spent - 2.5h
              2.5h

              Slack

                Issue deployment