ICEfaces
  1. ICEfaces
  2. ICE-9804

CLONE - Deadlock on Session invalidation/logout on WebSphere

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: EE-1.8.2.GA_P03
    • Fix Version/s: EE-1.8.2.GA_P08
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      WebSphere
    • Assignee Priority:
      P1
    • Salesforce Case Reference:

      Description

      When our SessionDispatcher.Listener runs, it checks to see if it should shut the session down. This is done in a thread that runs every 10 seconds and when it checks, it synchonizes on the SessionMonitors while it does so:

           try {
               synchronized (SessionMonitors) {
                   // Iterate over the session monitors using a copying iterator
                   Iterator iterator = new
      ArrayList(SessionMonitors.values()).iterator();
                   while (iterator.hasNext()) {
                       final Monitor sessionMonitor = (Monitor) iterator.next();
                       sessionMonitor.shutdownIfExpired();
                       
      ThreadLocalUtility.checkThreadLocals(ThreadLocalUtility.EXITING_SESSION_MONITOR);
                   }
               }

               Thread.sleep(10000);
           } catch (InterruptedException e) {
               //ignore interrupts
           }

      During the check to see if it should invalidate the session, it checks for a session attribute which, in WebSphere, appears to be a synchronized HashMap:

           Object o = session.getAttribute(POSITIVE_SESSION_TIMEOUT);

      The other thread is a request to logout which invalidates the current session and then sends out a SessionDestroyed event which we listen for. This, presumably, locks down that same HashMap that holds the session attributes *before* it sends the SessionDestroyed event. So while our own internal thread has grabbed the lock on the SessionMonitors the logout thread grabbed the lock on the session attribute map. Our SessionMonitor cannot continue to shutdown without getting the session attribute and the logout thread cannot continue with the SessionDestroyed call because the SessionMonitors lock is taken.
      1. ICE-9804.patch
        2 kB
        Mircea Toma

        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #40031 Fri Feb 14 11:55:11 MST 2014 mircea.toma ICE-9804 Remove synchronized access on "contexts" object. Use copying ArrayList when iterating over the list of contexts. Moved back into synchronized block the call to Monitor.addInSessionContext.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/SessionDispatcher.java

          People

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

            Dates

            • Created:
              Updated:
              Resolved: