1 Reply Latest reply on Aug 4, 2011 11:54 AM by Wang Liyu

    Session Object got stuck in the memory after called HttpSession.invalidate()

    Wang Liyu Apprentice

      I'm not sure if this is a bug or I coded wrong, I have session scoped bean that call FacesContext.getCurrentInstance().getExternalContext().invalidateSession() to release session (for example after user logout)
      and I found the instance's @PreDestroy method had been called on the request destroy event, but there is often one instances stuck in the memory, it seems the CreationalContextImpl.incompleteInstance map hold a hard reference to this instance.


      I have created a ticket https://issues.jboss.org/browse/WELD-950


      Just wondering if anyone has same issue or have a workaround?

        • 1. Re: Session Object got stuck in the memory after called HttpSession.invalidate()
          Wang Liyu Apprentice

          I'm not sure if anyone else has this problem? for a typical web app, you want to release the session/conversation/request beans when user logout, the easiest way is to call HttpSession.invalidate(), but I found it sometime there is always a session instances stuck in the memory.


          I'm wondering if this is right way to release the beans or should I use something else to release the object?


          I also found that if I call HttpSession.invalidate() at Phase 5 - INVOKE APP, it always stuck, if I call in pre-RENDER phase listener normally it will release, but sometime if the ViewExpired exception happened, it will stuck there.


          I think this is a major problem or bug. Could anyone from Weld Team clarify this for me?