ICEfaces
  1. ICEfaces
  2. ICE-4687

An exception during Request.respondWith(...) causes ThreadBlockingAdaptingServlet's semaphore to not be released.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.8.2-RC1, 1.8.2
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      ICEfaces Core, ICEfaces Push Server

      Description

      ICEfaces application bugs exposed a thread leak in the Thread Blocking environment. If an exception is thrown while trying to send a response to a request the Servlet Container supplied thread got blocked and never got unblocked. The Thread Blocking environment relies on semaphore logic to block and unblock the Servlet Container supplied thread. This thread tries to acquire the semaphore if no response is available causing this thread to block. When a response becomes available another thread releases the semaphore in order to unblock the Servlet Container supplied thread. If an exception occurred during this process the semaphore was not released.

      Basically, an exception during Request.respondWith(...) causes ThreadBlockingAdaptingServlet's semaphore to not be released:

          public void respondWith(ResponseHandler handler) throws Exception {
              super.respondWith(handler);
              if (semaphore == null) {
                  blockResponse = false;
              } else {
                  semaphore.release();
              }
          }

        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19049 Thu Jul 09 13:21:23 MDT 2009 jack.van.ooststroom Fixed JIRA ICE-4687 : An exception during Request.respondWith(...) causes ThreadBlockingAdaptingServlet's semaphore to not be released.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ThreadBlockingAdaptingServlet.java
        Jack Van Ooststroom created issue -
        Jack Van Ooststroom made changes -
        Field Original Value New Value
        Assignee Jack Van Ooststroom [ jack.van.ooststroom ]
        Hide
        Jack Van Ooststroom added a comment -

        Changed Fix Version(s) to 1.8.2

        Show
        Jack Van Ooststroom added a comment - Changed Fix Version(s) to 1.8.2
        Jack Van Ooststroom made changes -
        Salesforce Case []
        Fix Version/s 1.8.2 [ 10190 ]
        Hide
        Jack Van Ooststroom added a comment - - edited

        To reslove this issue a try-finally block is introduced to always ensure the release of the semaphore. Now the semaphore logic gets executed even if an exception occurred during respondWith(...):

        try

        { super.respondWith(handler); }

        finally {
        if (semaphore == null)

        { blockResponse = false; }

        else

        { semaphore.release(); }

        }

        Marking this one as FIXED.

        Show
        Jack Van Ooststroom added a comment - - edited To reslove this issue a try-finally block is introduced to always ensure the release of the semaphore. Now the semaphore logic gets executed even if an exception occurred during respondWith(...): try { super.respondWith(handler); } finally { if (semaphore == null) { blockResponse = false; } else { semaphore.release(); } } Marking this one as FIXED.
        Jack Van Ooststroom made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Jack Van Ooststroom made changes -
        Salesforce Case []
        Description An exception during Request.respondWith(...) causes ThreadBlockingAdaptingServlet's semaphore to not be released:

                public void respondWith(ResponseHandler handler) throws Exception {
                    super.respondWith(handler);
                    if (semaphore == null) {
                        blockResponse = false;
                    } else {
                        semaphore.release();
                    }
                }
        ICEfaces application bugs exposed a thread leak in the Thread Blocking environment. If an exception is thrown while trying to send a response to a request the Servlet Container supplied thread got blocked and never got unblocked. The Thread Blocking environment relies on semaphore logic to block and unblock the Servlet Container supplied thread. This thread tries to acquire the semaphore if no response is available causing this thread to block. When a response becomes available another thread releases the semaphore in order to unblock the Servlet Container supplied thread. If an exception occurred during this process the semaphore was not released.

        Basically, an exception during Request.respondWith(...) causes ThreadBlockingAdaptingServlet's semaphore to not be released:

            public void respondWith(ResponseHandler handler) throws Exception {
                super.respondWith(handler);
                if (semaphore == null) {
                    blockResponse = false;
                } else {
                    semaphore.release();
                }
            }
        Ken Fyten made changes -
        Salesforce Case []
        Priority Major [ 3 ] Critical [ 2 ]
        Ken Fyten made changes -
        Fix Version/s 1.8.2-RC1 [ 10210 ]
        Jack Van Ooststroom made changes -
        Environment ICEfaces Core ICEfaces Core, ICEfaces Push Server
        Salesforce Case []
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Jack Van Ooststroom
            Reporter:
            Jack Van Ooststroom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: