ICEfaces
  1. ICEfaces
  2. ICE-10816

Corrupt DOM updates being sent to browser

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-1.8.2.GA_P08
    • Fix Version/s: EE-1.8.2.GA_P09
    • Component/s: Bridge, Framework
    • Labels:
      None
    • Environment:
      All

      Description

      The following issue was raised by a customer:

      We have a problem in our ICEfaces 1.8.2 application where sometimes the updates that are sent back to the browser because of an asynchronous push gets corrupted.

      I have managed to reproduce this in our application and after adding trace I have found the following:

      1) After performing the lifecycle for the async push the PushModeSerializer adds the UpdateElements object to the view. This UpdateElements object contains the correct Element instances.
      2) When this UpdateElement is serialized at this point, the serialized value is as expected.
      3) The long-poll HTTP request now returns to the browser with the view ID that has the outstanding changes.
      4) The browser calls receive-updates to get the updates for the view. The SendUpdates class gets the corresponding view from the server and attempts to serialize the UpdateElements object, but the resulting string is not correct at all.

      It looks like the <update> being generated is getting corrupted because multiple threads are reading the DOM at the same time, but I am unable to figure out where this is happening.

      My guess is it's the processing of the DOM on a subsequent lifecycle that is interfering with the serializing of the updates.

      I have attached an example of this corruption:
      - SerialisedInLifecycle.xml contains the expected update packet (serialised when the UpdateElements was created during the JSF lifecycle).
      - SerialisedOnReceiveUpdates.xml contains the update packet that was sent to the browser in response to the receive-updates call (so serialised in a different thread to the original lifecycle).

      In this case, the content of the update was added to itself, causing a very incorrect DOM update to be applied in the browser. The corruptions are not always the same though.

      Unfortunately this problem is not easy to reproduce - I am using performance tests scripts doing about 2500 different workflows for 50 users and only get 1 or 2 corruptions. We do see this on our regression test environment using Selenium - probably once every 3 days, so it's not necessarily load related.

      The solution I currently have in mind is to serialize the updates as part of the lifecycle (instead of keeping references to the elements in the DOM) and storing a list of these serialized updates against the view (probably in StringBuffers or StringWriters). It will still support coalescing of updates, but it won't need prolonged access to the DOM.

      I think this issue is related to ICE-6841, that was raised by one of my ex-collagues a few years ago.

        Activity

        Hide
        Arran Mccullough added a comment -

        Attaches is a proposed patch to help resolve this issue. Here are the details from the customer:

        "I have done some more testing and also made some changes to 1.8.2.EE-P08 to try and fix the problem on my side.

        I have been running my performance tests against an ICEfaces 1.8.2 build with some custom fixes and so far I have not been able to reproduce the problem. When I revert back to the unpatched version I get the error pretty regularly.

        The changes I have made is to synchronize access to the DOM when:
        1) Calculating the DOM diffs.
        2) Applying changes submitted from the browser to the DOM.
        3) Serializing the UpdateElements.
        4) Coalescing multiple UpdateElements objects.

        The attached patch file was taken against the 1.8.2.EE.P08 source. "

        Show
        Arran Mccullough added a comment - Attaches is a proposed patch to help resolve this issue. Here are the details from the customer: "I have done some more testing and also made some changes to 1.8.2.EE-P08 to try and fix the problem on my side. I have been running my performance tests against an ICEfaces 1.8.2 build with some custom fixes and so far I have not been able to reproduce the problem. When I revert back to the unpatched version I get the error pretty regularly. The changes I have made is to synchronize access to the DOM when: 1) Calculating the DOM diffs. 2) Applying changes submitted from the browser to the DOM. 3) Serializing the UpdateElements. 4) Coalescing multiple UpdateElements objects. The attached patch file was taken against the 1.8.2.EE.P08 source. "
        Hide
        Mircea Toma added a comment -

        Applied customer's recommended patch for serializing access to the DOM.

        Show
        Mircea Toma added a comment - Applied customer's recommended patch for serializing access to the DOM.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: