Ticket #11372 (closed defect: wontfix)

Opened 13 months ago

Last modified 11 months ago

VaadinPortlet should implement destroy()

Reported by: dnebing Owned by: ticketmaster
Priority: undefined Milestone:
Component: Core Framework Version: 7.0.2
Keywords: Cc: dnebing@…
Depends on:
Workaround:
Verified:

Description

VaadinPortlet does not implement destroy() so the CurrentInstance leaves artifacts in memory (memory leak) when destroyed.

VaadinPortlet should implement the destroy() method and should invoke a new method on CurrentInstance to clean up and destroy the thread local.

Change History

comment:1 Changed 13 months ago by dnebing

  • Cc dnebing@… added

comment:2 Changed 13 months ago by dnebing

Should also probably add a portletDestroyed() method to allow subclasses to clean up resources, modeled after the portletInitialized() method to allow subclasses to initialize themselves.

comment:3 Changed 13 months ago by Artur Signell

  • Component changed from undefined to Core Framework

comment:4 Changed 11 months ago by Leif Astrand

  • Status changed from new to closed
  • Resolution set to wontfix

Clearing CurrentInstance in destroy() would only clean up the ThreadLocal of the thread where destroy() is run whereas any leaked CurrentInstance on other threads would still be there. The ThreadLocal API does not seem to allow accessing a ThreadLocal of another thread.

The correct way of avoiding leaks is to make sure CurrentInstance.clearAll() is run in a finally block in all places where there might be code that has set any instance. #11906 will fix this for VaadinServlet.init() and VaadinPortlet.init().

Please create separate tickets for any other situations where CurrentInstance.clearAll() might be missing.

Note: See TracTickets for help on using tickets.