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

NullPointerException from SessionsSecurityManager.start()

    XMLWordPrintableJSON

Details

    • Task
    • Status: Resolved
    • Minor
    • Resolution: Resolved
    • None
    • 2.0.0-alpha, 1.9.0
    • None
    • None

    Description

      We see this NPE intermittently from KNOX when a topology is being redeployed and a request is still being processed in Shiro's AuthenticatingFilter.

      In DelegatingSubject.java:

      log.trace("Starting session for host {}", getHost());
      SessionContext sessionContext = createSessionContext();
      // At this point the topology deploy already triggered a securityManager.destroy() so sessionManager is null
      Session session = this.securityManager.start(sessionContext); 
      this.session = decorate(session); 

      This is not a critical problem since the request will fail no matter what, but NPE suggests a programming error instead of a normal operation.

      I suggest putting a null check in securityManager.start() and throw an IllegalStateException("Session already destroyed") or something similar.

       

      See https://issues.apache.org/jira/browse/KNOX-2297 for more context.

      Attachments

        Issue Links

          Activity

            People

              fpapon Francois Papon
              amagyar Attila Magyar
              Votes:
              0 Vote for this issue
              Watchers:
              1 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 - 1h 40m
                  1h 40m