Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
UI not detached in Portal
Hi,
I use some Vaadin UIs as Portlets in a Liferay 6.1 Portal. Investigating possible Memory Leaks in my applications i found out that closing a broser tab with a vaadin portlet (closing last instance of a portlet) does not result in detaching the expired UI.
I would expect that after 3 missing heartbeats one of the next portal requests call my DetachListener and thn detaches and garbage collects the UI.
The detach mechanism works if there is at least 1 instance of a portlet making requests to the portal. Assume you have 5 instances on different browser tabs, closing 4 of them. After 3 missing heartbeats the next request from the last portelt instance removes all the other expired instances, but closing the last instance left the UI instance (and the VaadinSession) untouched forever.
I found out that the code handling the detaching of expired instances is in com.vaadin.server.VaadinService->requestEnd() and it seems that there are VaadinSessions for each type of portlet so that the cleanupSession works only for requests of the same portlet class type.
Is there a configuration or code example to get rid of the last portlet instance?
Regards
Michael
Hi,
I have the same issue and another one that seems related.
When I change page, I don't have any callback method to listen to the view detach event coming from the view that is displayed by the UI that has just been "closed"..