ICEfaces
  1. ICEfaces
  2. ICE-10491

PreDestroy annotated method not called for Window scope bean

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: EE-3.3.0.GA_P02, 4.0
    • Fix Version/s: EE-4.1.0.GA, EE-3.3.0.GA_P04
    • Component/s: Bridge, Framework
    • Labels:
      None
    • Environment:
      All

      Description

      In this scenario, a page uses a Window Scoped bean. This bean uses the @PreDestroy annotation. If the page is closed before it has a chance to finish loading this annotated method is not called. This also puts the state of new bean instances out of sync.

      The scenario is as follows with some logging:
       - Page is loaded and allowed to finish rendering and the page is closed.
      TestBean Constructor Called 31768553
      PostConstruct Called 31768553
      PreDestroy Called 31768553
       - The page is loaded again but this time it is closed before it finishes loading.
      TestBean Constructor Called 32617693
      PostConstruct Called 32617693
       - A new page instance is loaded and allowed to finish.
      TestBean Constructor Called 1021952
      PostConstruct Called 1021952
       - The previous page is closed and a new one is opened. In this instance the previous page bean is cleared when the new instance is loaded.
      PreDestroy Called 1021952
      TestBean Constructor Called 21790214
      PostConstruct Called 21790214
       - The first bean instance (32617693) that is closed before finished loading never calls it's PreDestroy method.

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows this issue. The server output will have similar logging as mentioned in the case description.

        Show
        Arran Mccullough added a comment - Attached test case that shows this issue. The server output will have similar logging as mentioned in the case description.
        Hide
        Ken Fyten added a comment - - edited

        Not sure we can do anything about this if the page hasn't finished loading, our JS won't be initialized, and thus, unable to process the close event either.

        Perhaps we could inline our onBeforeUnload cleanup code in the top of the HEAD or something to try to reduce the likelihood that the page would be closed before it is initialized?

        This wouldn't guarantee anything, but might make it less likely to occur.

        Show
        Ken Fyten added a comment - - edited Not sure we can do anything about this if the page hasn't finished loading, our JS won't be initialized, and thus, unable to process the close event either. Perhaps we could inline our onBeforeUnload cleanup code in the top of the HEAD or something to try to reduce the likelihood that the page would be closed before it is initialized? This wouldn't guarantee anything, but might make it less likely to occur.
        Hide
        Ken Fyten added a comment -

        Closing this as Won't Fix due to complexity of trying to initialize the cleanup JS functions inline in the page to try to have it execute even when the page load is aborted prematurely. Since the proactive cleanup doesn't occur when the page load is aborted the cleanup will not occur until the Session expires, which is deemed acceptable since this scenario should be relatively rare.

        Show
        Ken Fyten added a comment - Closing this as Won't Fix due to complexity of trying to initialize the cleanup JS functions inline in the page to try to have it execute even when the page load is aborted prematurely. Since the proactive cleanup doesn't occur when the page load is aborted the cleanup will not occur until the Session expires, which is deemed acceptable since this scenario should be relatively rare.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: