ICEfaces
  1. ICEfaces
  2. ICE-5980

Fix session expiration when only push notifications run

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Beta1
    • Fix Version/s: 2.0-Beta2, 2.0.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      server

      Description

      Need to expire user sessions when no user initiated requests are issued. Currently sessions will never expire if a ticking clock will trigger update retrieve requests. Also, no threads should be used in the implementation of this feature.

        Activity

        Mircea Toma created issue -
        Mircea Toma made changes -
        Field Original Value New Value
        Assignee Mircea Toma [ mircea.toma ]
        Mircea Toma made changes -
        Salesforce Case []
        Fix Version/s 2.0-Beta2 [ 10242 ]
        Mircea Toma made changes -
        Salesforce Case []
        Assignee Priority P2
        Deryk Sinotte made changes -
        Link This issue blocks ICE-5779 [ ICE-5779 ]
        Ken Fyten made changes -
        Assignee Priority P2 P1
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22384 Mon Sep 20 16:36:34 MDT 2010 mircea.toma ICE-5980 Introduced resource handler which monitors session timeout by excluding icepush related requests from updating the last access timestamp.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/javascript/application.js
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/resources/META-INF/faces-config.xml
        Commit graph ADD /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/SessionTimeoutMonitor.java
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/WindowScopeManager.java
        Hide
        Mircea Toma added a comment - - edited

        Introduced SessionTimeoutMonitor resource handler which monitors session timeout by keeping updated a last access timestamp in the session. The monitor excludes icepush related requests from updating the last access timestamp as opposed to the servlet container. This allows the monitor to detect when the only incoming requests are icepush initiated requests and expire the session.

        Show
        Mircea Toma added a comment - - edited Introduced SessionTimeoutMonitor resource handler which monitors session timeout by keeping updated a last access timestamp in the session. The monitor excludes icepush related requests from updating the last access timestamp as opposed to the servlet container. This allows the monitor to detect when the only incoming requests are icepush initiated requests and expire the session.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Deryk Sinotte added a comment -

        So the mechanism for handling session expiry when Push requests are active is:

        • A ResourceHandler called SessionTimeoutMonitor is active and reviews each incoming request.
        • Each incoming request does touch the session, so the SessionTimeoutMonitor detects whether or not the requests is a Push request or not.
        • If a the request is a not a Push request, then we create/update a our own synthetic timeout value in the session.
        • If a request is a Push request, then we do not modify this sythetic session value.
        • Finally, each request looks at the synthetic expiry value and, if the maxInactiveInterval has been exceeded, expires the session programmatically.

        What this means is that, if there are ONLY Push requests coming in, the "real" container session will never expire but our synthetic session activity calculation will eventually determine that a request (either Push or non-Push) has occurred that is longer than the maxInactive interval.

        Something we should note. Due to the nature of our calculation, our synthetic session expiry could occur up to one "heartbeat" later than an actual session expiry triggered by the servlet container. This is because an incoming Push request could fall just short of actually triggering the synthetic expiry and it would have to wait for the next "heartbeat" to trigger it. Currently, the default "heartbeat" interval for Push is 50 seconds which means that, given a real session timeout of 5 minutes, a synthetic expiry may occur as late as 5 minutes + 50 seconds.

        If this is deemed unacceptable, we could potentially mitigate this by:

        • doing a more complex calculation and calling setMaxInactiveInterval in order to try and get the servlet container to trigger the timeout at the exact time
        • use Filters (Servlet/Portlet 2) to achieve better results (we declined to do this in 1.8 due to the fact that it made the configuration more complex and that there were no filters for Portlets but both of these problems have been somewhat reduced since then)
        • discussing other possible solutions
        Show
        Deryk Sinotte added a comment - So the mechanism for handling session expiry when Push requests are active is: A ResourceHandler called SessionTimeoutMonitor is active and reviews each incoming request. Each incoming request does touch the session, so the SessionTimeoutMonitor detects whether or not the requests is a Push request or not. If a the request is a not a Push request, then we create/update a our own synthetic timeout value in the session. If a request is a Push request, then we do not modify this sythetic session value. Finally, each request looks at the synthetic expiry value and, if the maxInactiveInterval has been exceeded, expires the session programmatically. What this means is that, if there are ONLY Push requests coming in, the "real" container session will never expire but our synthetic session activity calculation will eventually determine that a request (either Push or non-Push) has occurred that is longer than the maxInactive interval. Something we should note. Due to the nature of our calculation, our synthetic session expiry could occur up to one "heartbeat" later than an actual session expiry triggered by the servlet container. This is because an incoming Push request could fall just short of actually triggering the synthetic expiry and it would have to wait for the next "heartbeat" to trigger it. Currently, the default "heartbeat" interval for Push is 50 seconds which means that, given a real session timeout of 5 minutes, a synthetic expiry may occur as late as 5 minutes + 50 seconds. If this is deemed unacceptable, we could potentially mitigate this by: doing a more complex calculation and calling setMaxInactiveInterval in order to try and get the servlet container to trigger the timeout at the exact time use Filters (Servlet/Portlet 2) to achieve better results (we declined to do this in 1.8 due to the fact that it made the configuration more complex and that there were no filters for Portlets but both of these problems have been somewhat reduced since then) discussing other possible solutions
        Hide
        Ken Fyten added a comment -

        This feature no longer seems to be working correctly.

        Using icefaces2/trunk rev. #22683 any sample with push active will never expire.

        Tested were compat showcase with lazyPush=false as well as auctionMonitor.

        Compat showcase with lazyPush=true expires as expected (and displays Session Expired dialog after user interaction post-expiry).

        Show
        Ken Fyten added a comment - This feature no longer seems to be working correctly. Using icefaces2/trunk rev. #22683 any sample with push active will never expire. Tested were compat showcase with lazyPush=false as well as auctionMonitor. Compat showcase with lazyPush=true expires as expected (and displays Session Expired dialog after user interaction post-expiry).
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Ken Fyten added a comment -

        Auction seems to expire fine though.

        Show
        Ken Fyten added a comment - Auction seems to expire fine though.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22704 Wed Oct 20 13:57:06 MDT 2010 mircea.toma ICE-5980 Define SessionExpiredListener in the core taglib file instead of using Servlet 3.0 annotation.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/impl/application/SessionExpiredListener.java
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/resources/META-INF/core.tld
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22705 Wed Oct 20 13:59:18 MDT 2010 mircea.toma ICE-5980 When redirect URI is not defined set null object instead of 'null' as JS configuration value.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/java/org/icefaces/util/EnvUtils.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22706 Wed Oct 20 14:58:55 MDT 2010 mircea.toma ICE-5980 When redirect URI is not defined set null object instead of 'null' as JS configuration value.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/java/com/icesoft/faces/application/ExtrasSetup.java
        Hide
        Mircea Toma added a comment -

        Defining SessionExpiredListener in the core taglib file instead of using Servlet 3.0 annotation so that apps running in Servlet 2.5 containers can still work.

        Show
        Mircea Toma added a comment - Defining SessionExpiredListener in the core taglib file instead of using Servlet 3.0 annotation so that apps running in Servlet 2.5 containers can still work.
        Hide
        Mircea Toma added a comment -

        When redirect URI is not defined set null object instead of 'null' as JS configuration value. This way the bridge will not try to use 'null' value as URI to redirect to.

        Show
        Mircea Toma added a comment - When redirect URI is not defined set null object instead of 'null' as JS configuration value. This way the bridge will not try to use 'null' value as URI to redirect to.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Ken Fyten added a comment -

        Testing with rev # 22707 shows that compat auctionMonitor never seems to expire.

        Show
        Ken Fyten added a comment - Testing with rev # 22707 shows that compat auctionMonitor never seems to expire.
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #22721 Thu Oct 21 07:15:23 MDT 2010 mircea.toma ICE-5980 Disable connection lost and connection trouble indicator when the session expired callback is invoked.
        Files Changed
        Commit graph MODIFY /icefaces2/trunk/icefaces/compat/core/src/main/javascript/status.js
        Hide
        Mircea Toma added a comment -

        When 'strictSessionTimeout' is enabled I can see "Network Connection Interrupted" indicator showing up when the session expires. On a closer look I can see the "User Session Expired" popup rendered under the "Network Connection Iterrupted" popup. This is due to the decoupling we now have between ICEfaces bridge and ICEpush bridge, the ICEpush bridge has no knowlenge about sessions it just sees the network connection dropped.

        Changed session expired indicator to disable connection lost and connection trouble indicators on session expiry.

        Show
        Mircea Toma added a comment - When 'strictSessionTimeout' is enabled I can see "Network Connection Interrupted" indicator showing up when the session expires. On a closer look I can see the "User Session Expired" popup rendered under the "Network Connection Iterrupted" popup. This is due to the decoupling we now have between ICEfaces bridge and ICEpush bridge, the ICEpush bridge has no knowlenge about sessions it just sees the network connection dropped. Changed session expired indicator to disable connection lost and connection trouble indicators on session expiry.
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 2.0.0 [ 10230 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P1

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Mircea Toma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: