ICEfaces
  1. ICEfaces
  2. ICE-8555

ice:panelPopup leaking memory when displayed and hidden

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0, EE-3.0.0.GA
    • Fix Version/s: EE-3.2.0.BETA, EE-3.2.0.GA, 3.3
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      IE 8, Glassfish or Tomcat, any page with ice:panelPopup. Live showcase also shows issue.
    • Assignee Priority:
      P1
    • Workaround Description:
      Hide
      The simplest and quite correct workaround is to add the f:ajax or ace:ajax tag to the "Cancel" h:commandButton. This way the ICEfaces form submit is executed and ice.onElementUpdate callbacks are invoked. Also when the "Cancel" button is clicked the file upload will not proceed, this is the correct part since you don't want to upload the file but to cancel instead.
      Show
      The simplest and quite correct workaround is to add the f:ajax or ace:ajax tag to the "Cancel" h:commandButton. This way the ICEfaces form submit is executed and ice.onElementUpdate callbacks are invoked. Also when the "Cancel" button is clicked the file upload will not proceed, this is the correct part since you don't want to upload the file but to cancel instead.

      Description

      In terms of seeing a leak the showcase offers a simple test. Go to the ice:panelPopup Overview (http://icefaces-showcase.icesoft.org/showcase.jsf?grp=compatMenu&exp=popup) in IE 8. Note the starting memory, then open/close the popup 5 times.
      In my case the result looked like this:

      Initial Task Manager Memory: 32408
      Open/Close One Time: 45596
      Two: 54188
      Three: 63676
      Four: 71076
      Five: 79300
      Total Increase: 46.892mb

      If you navigate to another page in the app via the links on the left the memory will drop off. In my case clicking the panelDivider link restored the memory to 39504.

      As you can see when they AREN'T navigating this constant increase is going to be a problem.

      Similarly when looking at the page in Google Chrome you can see a huge jump in detached DOM elements. Opening the popup once and taking a Heap Snapshot revealed 11, 29, and 2019 entries. In this case the 29 entries have their Objects Count increased by 1 each time the popup is toggled again.

      Testing with the patches from ICE-8500 shows less of a leak.

      Note that a quick test using the ace:dialog demo on Showcase seems like it doesn't leak memory.
      1. FileEntryPopupTest.zip
        20 kB
        Arran Mccullough
      2. FileEntryPopupTestWAR.zip
        9.34 MB
        Arran Mccullough
      1. screenshot-01.png
        161 kB

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows recent issue.

        Steps:

        • Load welcomeICEfaces.jsf
        • Click on the Open Button, modal panelPopup is shown that includes an ace:fileEntry, Upload button, and two Cancel buttons.
        • Clicking on the "ICE - Cancel" button closes the popup and the popup can be reoponed.
        • Clicking on the "H - Cancel" button closed the popup but it can't be reopened.
        • Looking at the source of the Open button, its tabindex is set to -1 even though the modal layer is gone.
        Show
        Arran Mccullough added a comment - Attached test case that shows recent issue. Steps: Load welcomeICEfaces.jsf Click on the Open Button, modal panelPopup is shown that includes an ace:fileEntry, Upload button, and two Cancel buttons. Clicking on the "ICE - Cancel" button closes the popup and the popup can be reoponed. Clicking on the "H - Cancel" button closed the popup but it can't be reopened. Looking at the source of the Open button, its tabindex is set to -1 even though the modal layer is gone.
        Hide
        Mircea Toma added a comment -

        The recent issue is caused by the use of ace:fileEntry, this component disables the form submit capturing and it does its own form submit. When the form submit does not go through jsf.ajax.request function the ice.onElementUpdate callbacks are not invoked, causing the onclick, onkeypress, onleyup and onkeydown callbacks that block the interaction with elements underneath the modal overlay to not be cleared when the modal popup is closed. This is the reason why the "Open" button does not respond, the click events are blocked by the overlay iframe (which is still present but hidden).

        Show
        Mircea Toma added a comment - The recent issue is caused by the use of ace:fileEntry, this component disables the form submit capturing and it does its own form submit. When the form submit does not go through jsf.ajax.request function the ice.onElementUpdate callbacks are not invoked, causing the onclick, onkeypress, onleyup and onkeydown callbacks that block the interaction with elements underneath the modal overlay to not be cleared when the modal popup is closed. This is the reason why the "Open" button does not respond, the click events are blocked by the overlay iframe (which is still present but hidden).
        Hide
        Mircea Toma added a comment -

        Reverting the changes for PanelPopupRenderer to register the iframe cleanup code with ice.onElementRemove is not possible because ice.onElementRemove callbacks are invoked after the updates are applied, too late for the callback code to cleanup the memory leak inducing callbacks.

        Show
        Mircea Toma added a comment - Reverting the changes for PanelPopupRenderer to register the iframe cleanup code with ice.onElementRemove is not possible because ice.onElementRemove callbacks are invoked after the updates are applied, too late for the callback code to cleanup the memory leak inducing callbacks.
        Hide
        Mircea Toma added a comment -

        Changing the file entry renderer to do its own form submit only when the "Upload" button is clicked is not possible because the button is rendered by a plain h:commandButton component.

        Show
        Mircea Toma added a comment - Changing the file entry renderer to do its own form submit only when the "Upload" button is clicked is not possible because the button is rendered by a plain h:commandButton component.
        Hide
        Mircea Toma added a comment -

        The simplest and quite correct workaround is to add the f:ajax or ace:ajax tag to the "Cancel" h:commandButton. This way the ICEfaces form submit is executed and ice.onElementUpdate callbacks are invoked. Also when the "Cancel" button is clicked the file upload will not proceed, this is the correct part since you don't want to upload the file but to cancel instead.

        Show
        Mircea Toma added a comment - The simplest and quite correct workaround is to add the f:ajax or ace:ajax tag to the "Cancel" h:commandButton. This way the ICEfaces form submit is executed and ice.onElementUpdate callbacks are invoked. Also when the "Cancel" button is clicked the file upload will not proceed, this is the correct part since you don't want to upload the file but to cancel instead.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Carlo Guglielmin
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: