Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1565

Session already invalidated error on requestDestroyed callback

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Major
    • Resolution: Duplicate
    • 2.1.0.Final
    • None
    • None
    • None

    Description

      We use the org.jboss.weld.environment.servlet.Listener to enable our servlet application to use weld.
      On user logout we invalidate the session and redirect the user away.
      It seems like tomcat is firing a requestDestroyed when we do that (that is, after we invalidate the session)

      The weld code then produces this stack trace:

      java.lang.IllegalStateException: getAttribute: Session already invalidated
      at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1167)
      at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:122)
      at org.jboss.weld.context.http.HttpConversationContextImpl.getSessionAttribute(HttpConversationContextImpl.java:29)
      at org.jboss.weld.context.http.HttpConversationContextImpl.getSessionAttribute(HttpConversationContextImpl.java:13)
      at org.jboss.weld.context.AbstractConversationContext.copyConversationIdGeneratorAndConversationsToSession(AbstractConversationContext.java:177)
      at org.jboss.weld.context.AbstractConversationContext.dissociate(AbstractConversationContext.java:161)
      at org.jboss.weld.servlet.ConversationContextActivator.disassociateConversationContext(ConversationContextActivator.java:171)
      at org.jboss.weld.servlet.HttpContextLifecycle.requestDestroyed(HttpContextLifecycle.java:236)
      at org.jboss.weld.servlet.WeldInitialListener.requestDestroyed(WeldInitialListener.java:118)
      at org.jboss.weld.servlet.api.helpers.ForwardingServletListener.requestDestroyed(ForwardingServletListener.java:38)
      at org.apache.catalina.core.StandardContext.fireRequestDestroyEvent(StandardContext.java:6137)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)

      I feel that somehow copyConversationIdGeneratorAndConversationsToSession should check if the session is valid.
      On the other hand, I wonder if that conversation context dance need to be done at all. We are not using this scope.

      Attachments

        Issue Links

          Activity

            People

              mkouba@redhat.com Martin Kouba
              fabianlange_jira Fabian Lange (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: