Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-64649

Registered servlet context listeners have their sessionDestroyed(HttpSessionEvent) method called after the HttpSession is already invalidated

    Details

      Description

      Note this LPS is just to track down solution from Equinox that will be added in Liferay. Equinox bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=490638

      Problem Background

      It is valid to manipulate session attributes in a ServletContextListener.sessionDestroyed(HttpSessionEvent) method. However, Liferay Portal is calling sessionDestroyed after the HttpSession is already invalidated.

      Steps to Reproduce

      1. Before starting Liferay, configure its web.xml so session timeout has a very low value to reproduce error soon (i.e: <session-timeout>1</session-timeout>)
      2. Start Liferay Portal 7 CE
      3. Deploy the attached jsf-applicant-portlet.war module
      4. Create a new portal page and add the "jsf-applicant" portlet to the page.
      5. Reload the portal page
      6. Wait until session timeout happens (should happen in 1 minute approx.).
      7. Check logs

      Expected result: There are no errors in the server log.

      Actual result: The following WARN and stacktrace appears in the server log:

       java.lang.IllegalStateException: getAttribute: Session already invalidated
      	at org.apache.catalina.session.StandardSession.getAttribute(StandardSession.java:1190)
      	at org.apache.catalina.session.StandardSessionFacade.getAttribute(StandardSessionFacade.java:103)
      	at org.eclipse.equinox.http.servlet.internal.servlet.HttpSessionAdaptor.getAttribute(HttpSessionAdaptor.java:186)
      	at com.sun.faces.application.view.ViewScopeManager.sessionDestroyed(ViewScopeManager.java:373)
      	at com.sun.faces.application.WebappLifecycleListener.sessionDestroyed(WebappLifecycleListener.java:199)
      	at com.sun.faces.config.ConfigureListener.sessionDestroyed(ConfigureListener.java:407)
      	at sun.reflect.GeneratedMethodAccessor1211.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.eclipse.equinox.http.servlet.internal.registration.ListenerRegistration$EventListenerInvocationHandler.invoke(ListenerRegistration.java:132)
      	at com.sun.proxy.$Proxy703.sessionDestroyed(Unknown Source)
      	at org.eclipse.equinox.http.servlet.internal.servlet.HttpSessionAdaptor.invalidate(HttpSessionAdaptor.java:223)
      	at org.eclipse.equinox.http.servlet.internal.servlet.HttpSessionAdaptor$ParentSessionListener.valueUnbound(HttpSessionAdaptor.java:47)
      	at org.apache.catalina.session.StandardSession.removeAttributeInternal(StandardSession.java:1838)
      	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:891)
      	at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:694)
      	at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:666)
      	at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:651)
      	at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5625)
      	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1377)
      	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
      	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1381)
      	at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1349)
      	at java.lang.Thread.run(Thread.java:744)
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 18 weeks, 5 days ago

                  Packages

                  Version Package
                  7.0.1 CE GA2