ICEfaces
  1. ICEfaces
  2. ICE-5649

Deadlock on session invalidation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2-EE-GA_P01
    • Fix Version/s: 1.8.3, EE-1.8.2.GA_P04
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      WebSphere 6.1

      Description

      Customer reports that a deadlock can occur during session invalidation on WebSphere 6.1

      "Two threads used an instance of View class (on session invalitation), and one thread locked the HTTP session, the second thread locked the lifecycleLock field. They were waiting for each others monitors."

        Issue Links

          Activity

          Deryk Sinotte created issue -
          Hide
          Deryk Sinotte added a comment -

          Scheduling for next EE release. Customer has proposed a fix they would like us to validate for correctness and potential side-effects:

          Index: src/com/icesoft/faces/context/View.java
          ===================================================================
          — src/com/icesoft/faces/context/View.java (revision 21174)
          +++ src/com/icesoft/faces/context/View.java (working copy)
          @@ -53,6 +53,7 @@
          import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock;
          import org.apache.commons.logging.Log;
          import org.apache.commons.logging.LogFactory;
          +import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;

          import javax.servlet.http.HttpSession;
          import java.lang.reflect.Constructor;
          @@ -247,12 +248,16 @@

          public void dispose() {
          try {

          • acquireLifecycleLock();
            + if (!lifecycleLock.isHeldByCurrentThread()) { + lifecycleLock.tryLock(30, TimeUnit.SECONDS); + }

            dispose.run();
            ContextEventRepeater.viewNumberDisposed(
            facesContext.getExternalContext().getSession(false),
            sessionID,
            Integer.parseInt(viewIdentifier));
            + } catch (InterruptedException exception)

            { + // do nothing. }

            finally

            { releaseLifecycleLockUnconditionally(); }
          Show
          Deryk Sinotte added a comment - Scheduling for next EE release. Customer has proposed a fix they would like us to validate for correctness and potential side-effects: Index: src/com/icesoft/faces/context/View.java =================================================================== — src/com/icesoft/faces/context/View.java (revision 21174) +++ src/com/icesoft/faces/context/View.java (working copy) @@ -53,6 +53,7 @@ import edu.emory.mathcs.backport.java.util.concurrent.locks.ReentrantLock; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; import javax.servlet.http.HttpSession; import java.lang.reflect.Constructor; @@ -247,12 +248,16 @@ public void dispose() { try { acquireLifecycleLock(); + if (!lifecycleLock.isHeldByCurrentThread()) { + lifecycleLock.tryLock(30, TimeUnit.SECONDS); + } dispose.run(); ContextEventRepeater.viewNumberDisposed( facesContext.getExternalContext().getSession(false), sessionID, Integer.parseInt(viewIdentifier)); + } catch (InterruptedException exception) { + // do nothing. } finally { releaseLifecycleLockUnconditionally(); }
          Deryk Sinotte made changes -
          Field Original Value New Value
          Estimated Complexity Medium
          Original Estimate 1d
          Salesforce Case [5007000000C1vCQ]
          Fix Version/s 1.8.2-EE-GA_P02 [ 10226 ]
          Assignee Priority P2
          Security Private [ 10001 ]
          Assignee Mircea Toma [ mircea.toma ]
          Ken Fyten made changes -
          Security Private [ 10001 ]
          Ken Fyten made changes -
          Assignee Priority P2
          Hide
          Mircea Toma added a comment -

          The proposed patch is safe to apply. Timing out the lock should not introduce any side effects. By the time the timeout has elapsed any JSF lifecycle (still running at the moment of session invalidation) has had enough time to fully execute.

          Show
          Mircea Toma added a comment - The proposed patch is safe to apply. Timing out the lock should not introduce any side effects. By the time the timeout has elapsed any JSF lifecycle (still running at the moment of session invalidation) has had enough time to fully execute.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Priority P2
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P2
          Assignee Mircea Toma [ mircea.toma ]
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Assignee Priority P1
          Ken Fyten made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Assignee Priority P1
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #24901 Mon Jun 27 07:22:41 MDT 2011 mircea.toma ICE-5649 Apply patch recommended by client. The introduced change exits the potential dead-lock after 30 seconds to allow the session to expire.
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/context/View.java
          Mircea Toma made changes -
          Assignee Mircea Toma [ mircea.toma ]
          Mircea Toma made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          Hide
          Mircea Toma added a comment -

          Applied patch recommended by client. The introduced change exits the potential dead-lock after 30 seconds to allow the session to expire.

          Show
          Mircea Toma added a comment - Applied patch recommended by client. The introduced change exits the potential dead-lock after 30 seconds to allow the session to expire.
          Mircea Toma made changes -
          Fix Version/s 1.8.3 [ 10211 ]
          Fix Version/s 1.8.2-EE-GA_P02 [ 10226 ]
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s EE-1.8.2.GA_P04 [ 10280 ]
          Ken Fyten made changes -
          Link This issue is duplicated by ICE-5535 [ ICE-5535 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #28109 Thu Mar 01 12:40:54 MST 2012 arran.mccullough ICE-5649 Apply patch recommended by client. The introduced change exits the potential dead-lock after 30 seconds to allow the session to expire.
          Files Changed
          Commit graph MODIFY /icefaces/scratchpads/patches/sf-10973/icefaces/core/src/com/icesoft/faces/context/View.java
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

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

              Dates

              • Created:
                Updated:
                Resolved: