ICEfaces
  1. ICEfaces
  2. ICE-5684

Allow bridge to order when responses are processed

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2, 1.8.2-EE-GA_P01
    • Fix Version/s: 1.8.2-EE-GA_P02
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Linux
      Glassfish 2.2.1
      Firefox 3.6 / IE 8

      Description

      When the ICEfaces application is configured to support asynchronous communication, there's no mechanism for the brodge to ensure that responses are processed in the order in which their requests are sent. We have a scenario where clicking on a link starts a page navigation. It also enabled addtional code in our server component which results in an asynchronous message (from our server application to the web application) that instructs a new tab on the page (being displayed) to be active. Because the original request is navigating to a new page, the response is quite large. The subsequent asynchronous request uses a server push to notify the browser to update itself.

      Within the web application in the server, everything appears to be processed in the correct order. The async render does not occur until after the initial request is handled. However, in the browser the response for the server push is handled before the original request's response is handled. This causes the application to behave incorrectly in the browser.

      When the application is configured for asynchronous communication, it would be good if the bridge could process the responses in the same order in which the requests were sent.

        Activity

        Hide
        Ed Hillmann added a comment -

        Here is a patch against 1.8.2-EE Patch 1 that updates the bridge. This update keeps track of the requests sent against the ui connection and processes the results in the request order.

        This can be enabled by setting the parameter "com.icesoft.faces.orderedResponseProcessing" to true in the web.xml. This functionality is only enabled if the application is configured to use asynchronous requests. If the ICEfaces application is synchronous, this functionality will not be active.

        Show
        Ed Hillmann added a comment - Here is a patch against 1.8.2-EE Patch 1 that updates the bridge. This update keeps track of the requests sent against the ui connection and processes the results in the request order. This can be enabled by setting the parameter "com.icesoft.faces.orderedResponseProcessing" to true in the web.xml. This functionality is only enabled if the application is configured to use asynchronous requests. If the ICEfaces application is synchronous, this functionality will not be active.
        Hide
        Ted Goddard added a comment -

        Ordering of responses containing page updates is an important property.

        Show
        Ted Goddard added a comment - Ordering of responses containing page updates is an important property.
        Hide
        Ted Goddard added a comment -

        Mircea, please review the patch.

        Show
        Ted Goddard added a comment - Mircea, please review the patch.
        Hide
        Mircea Toma added a comment -

        The patch looks good. I will have to do some more testing before applying it.

        Ed, I was wondering if you tried saving the pending responses without caching them since the ajax.js code creates new request objects for every submit?
        Also, I believe the beforeSend() method needs to be called like this:
        ....
        this.sendChannel.postAsynchronously(this.pingURI, this.defaultQuery.asURIEncodedString(), function(request)

        { Connection.FormPost(request); this.beforeSend(request); request.on(Connection.OK, this.receiveCallback); request.on(Connection.OK, Connection.Close); }

        .bind(this));
        ....

        This way the method is called when the request is issued.

        Show
        Mircea Toma added a comment - The patch looks good. I will have to do some more testing before applying it. Ed, I was wondering if you tried saving the pending responses without caching them since the ajax.js code creates new request objects for every submit? Also, I believe the beforeSend() method needs to be called like this: .... this.sendChannel.postAsynchronously(this.pingURI, this.defaultQuery.asURIEncodedString(), function(request) { Connection.FormPost(request); this.beforeSend(request); request.on(Connection.OK, this.receiveCallback); request.on(Connection.OK, Connection.Close); } .bind(this)); .... This way the method is called when the request is issued.
        Hide
        Mircea Toma added a comment -

        Committed the patch with a few modifications. The response ordering configuration was removed from the patch. Requests that don't receive their corresponding responses in less than 5 minutes are removed from the request/response queue to avoid memory leaks. Changed some of the code to be more consistent in style with the rest of the bridge code.

        Show
        Mircea Toma added a comment - Committed the patch with a few modifications. The response ordering configuration was removed from the patch. Requests that don't receive their corresponding responses in less than 5 minutes are removed from the request/response queue to avoid memory leaks. Changed some of the code to be more consistent in style with the rest of the bridge code.
        Hide
        Mircea Toma added a comment -

        Ed, would it be possible for you verify these fixes in the environment you used for replicating this issue? That will help confirming that we have the right implementation for response ordering.
        In the mean time I will try to setup a test case that will delay certain responses so that QA can verify this feature regularly.

        Show
        Mircea Toma added a comment - Ed, would it be possible for you verify these fixes in the environment you used for replicating this issue? That will help confirming that we have the right implementation for response ordering. In the mean time I will try to setup a test case that will delay certain responses so that QA can verify this feature regularly.
        Hide
        Ed Hillmann added a comment -

        Sure. What's the easiest way to get a copy of the source? SVN checkout?

        Show
        Ed Hillmann added a comment - Sure. What's the easiest way to get a copy of the source? SVN checkout?
        Hide
        Mircea Toma added a comment -

        The public SVN will be updated in a few hours. You can use the " Subversion Commits" tab to check when the check-in is public, when you see it listed you can go ahead and checkout the sources from the public repository.

        Show
        Mircea Toma added a comment - The public SVN will be updated in a few hours. You can use the " Subversion Commits" tab to check when the check-in is public, when you see it listed you can go ahead and checkout the sources from the public repository.
        Hide
        Ed Hillmann added a comment -

        I've tested these changes successfully. The processing order is preserved. Thanks very much for your help in this matter.

        Show
        Ed Hillmann added a comment - I've tested these changes successfully. The processing order is preserved. Thanks very much for your help in this matter.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: