ICEfaces
  1. ICEfaces
  2. ICE-8833

Session leak in SessionMonitors

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-1.8.2.GA_P05
    • Fix Version/s: EE-1.8.2.GA_P06
    • Component/s: None
    • Labels:
      None
    • Environment:
      icefaces-1.8.2 revision 32630 from trunk, tomcat 6.0.32, jdk 1.6_027
    • Assignee Priority:
      P2

      Description

      SessionDispatcher do not remove invalidated sessions from Map.
      In worst case users notice thousands of unused session objects (some old Jira issues I saw here).
      I attached file SessionDispatcher.java with additional logger messages.

      Test case.
      Prepare app with form-login for basic authentication and logout button.
      If you logon and logout few times 'Session Monitor session count' grows and many 'session already invalidated' messages occurs every 10 seconds..

      The main reason is line:
         iterator = new ArrayList(SessionMonitors.values()).iterator();
      Session cleaner do not clean correct list.
      After change to
         iterator = SessionMonitors.values().iterator();
      everything seems to be ok and sessions are removed.
      1. SessionDispatcher.java
        21 kB
        Krashan Brahmanjara
      2. SessionDispatcher.java
        20 kB
        Krashan Brahmanjara
      3. SessionDispatcher.java
        20 kB
        Krashan Brahmanjara
      4. sessionerrors.txt
        4 kB
        Krashan Brahmanjara
      5. sessionlog.txt
        2 kB
        Krashan Brahmanjara
      6. sessionlog2.txt
        3 kB
        Krashan Brahmanjara
      7. sessionlog3.txt
        3 kB
        Krashan Brahmanjara
      8. web.xml
        11 kB
        Krashan Brahmanjara
      1. sessionproblems.PNG
        85 kB

        Activity

        Hide
        Krashan Brahmanjara added a comment - - edited

        Added SessionDispatched.java with 'key' fix and Mircea Toma last changes

        Show
        Krashan Brahmanjara added a comment - - edited Added SessionDispatched.java with 'key' fix and Mircea Toma last changes
        Hide
        Deryk Sinotte added a comment -

        Please review last comments to ensure our fix is valid and complete.

        Show
        Deryk Sinotte added a comment - Please review last comments to ensure our fix is valid and complete.
        Hide
        Krashan Brahmanjara added a comment - - edited

        Last three post was verified with complex application based of last Icefaces 1.8 from trunk. My web.xml in attachment.
        I took clean copy of SessionDispatcher and merged it with my logger messages.
        After this I still saw SessionMonitor items with key not equal to sessionId and they can never be removed from the map (even after invalidation by Tomcat engine like in sessionerrors.txt).
        My additional patch was necessary to pass performance and memory leaks tests

        Show
        Krashan Brahmanjara added a comment - - edited Last three post was verified with complex application based of last Icefaces 1.8 from trunk. My web.xml in attachment. I took clean copy of SessionDispatcher and merged it with my logger messages. After this I still saw SessionMonitor items with key not equal to sessionId and they can never be removed from the map (even after invalidation by Tomcat engine like in sessionerrors.txt). My additional patch was necessary to pass performance and memory leaks tests
        Hide
        Mircea Toma added a comment -

        Applied (slightly modified) patch provided by Krashan. The fix modifies Monitor class to removes itself from the list of running monitors when invalidating an expired session. Also, changed getId() to a static method so that it can be used in all the places where the session ID is required.

        The fix was tested in following scenarios:
        A) natural session expiry
        B) invalidated after accessing the app through a login form
        C) application redeploy while session still valid
        D) waking up the machine, after being put to sleep while the session still valid

        In all the cases there were no SessionMonitor instances being left in the list of session monitors.

        Show
        Mircea Toma added a comment - Applied (slightly modified) patch provided by Krashan. The fix modifies Monitor class to removes itself from the list of running monitors when invalidating an expired session. Also, changed getId() to a static method so that it can be used in all the places where the session ID is required. The fix was tested in following scenarios: A) natural session expiry B) invalidated after accessing the app through a login form C) application redeploy while session still valid D) waking up the machine, after being put to sleep while the session still valid In all the cases there were no SessionMonitor instances being left in the list of session monitors.
        Hide
        Krashan Brahmanjara added a comment -

        Improved version works perfectly.

        Show
        Krashan Brahmanjara added a comment - Improved version works perfectly.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: