ICEfaces
  1. ICEfaces
  2. ICE-6984

Memory Leak when updating the outputChart component using Push

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.2-EE-GA_P02, EE-1.8.2.GA_P03
    • Fix Version/s: EE-1.8.2.GA_P04
    • Component/s: Framework, ICE-Components
    • Labels:
      None
    • Environment:
      All

      Description

      Issue description from customer:

      We are seeing errors when using the OutputChart component and having multiple browser windows or tasb from the same browser view the same page. The application is configured with "com.icesoft.faces.concurrentDOMViews" set to true and "com.icesoft.faces.synchronousUpdate" set to false.

      I have reproduced this with a simple web app with two charts on it that are being updated by a background thread once per second. With two browser windows looking at the same page, the chart images swap places, become unavailable, etc.

      Also I have noticed severe memory leaks with this type of application. Looking at the source, I see that the image resource is registered but is never released until the session expires. With a long running session, this will chew through memory.

      See file "com.icesoft.faces.webapp.http.core.ResourceDispatcher". The "registered" property (an ArrayList) is always added to, but only cleared when the session expires.

      Also see "com.icesoft.faces.webapp.http.common.standard.pathDispatcherServer". It maintains two ArrayList properties, "matchers" and "servers" that also grow without bounds in the situation.

      I understand that the requirement to have dynamic resource stay available, but in this case, the chart component is being updated. So maybe the when the chart is updated, the resource for the previous image should replace the resource or the resource name should be the constant, so that for a chart component the resource URL would remain constant but the content would change. Obviously the would require the proper caching and expiration meta data to force the browser to refetch the image.
      1. AbstractChart.java
        14 kB
        Arran Mccullough
      2. ChartResource.java
        3 kB
        Arran Mccullough
      3. ResourceDispatcher.java
        13 kB
        Arran Mccullough

        Activity

        Hide
        Arran Mccullough added a comment -

        Potential Fix from customer:

        I did a fix for the GA version. I will attach my files. I did see corruption in the "registered" ArrayList with multiple browser windows accessing the same page.

        The fix is to three files: ChartResource.java, AbstractChart.java, and ResourceDispather.

        I noticed that ResourceDispatcher had a "deregisterResource" method that I could use. I modified "AbstractChart.encode" to grab a hold of the previous ChartResource and then deregister that after the new ChartResource. To do so, I had to modify "ChartResource.caclulateDigest". This method uses the current time in milliseconds as part of its computation, so each time it is called, it computes and returns a different digest string. This makes the call in "ResourceDispatcher.deregisterResource" fail to find the resource since its digest is not the same as the one used when it was registered.

        Show
        Arran Mccullough added a comment - Potential Fix from customer: I did a fix for the GA version. I will attach my files. I did see corruption in the "registered" ArrayList with multiple browser windows accessing the same page. The fix is to three files: ChartResource.java, AbstractChart.java, and ResourceDispather. I noticed that ResourceDispatcher had a "deregisterResource" method that I could use. I modified "AbstractChart.encode" to grab a hold of the previous ChartResource and then deregister that after the new ChartResource. To do so, I had to modify "ChartResource.caclulateDigest". This method uses the current time in milliseconds as part of its computation, so each time it is called, it computes and returns a different digest string. This makes the call in "ResourceDispatcher.deregisterResource" fail to find the resource since its digest is not the same as the one used when it was registered.
        Hide
        Arran Mccullough added a comment -

        Patched ICEfaces code.

        Show
        Arran Mccullough added a comment - Patched ICEfaces code.

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: