Liferay timeout when using Vaadin portlet

Hi,

I have been working on Vaadin for awhile, and one problem bothered a lot,
that after a Vaadin portlet (using ApplicationPortlet2) is deployed in Liferay 6, Liferay will eventually timeout even user still using the portlet application.

I found there were some tickets related to older version of Liferay, but is the problem solved? Or there are some Liferay things need to fix?

Thank you

Figured a solution, not the best one though,

By configuring Liferay portal-ext.properties

session related

session.timeout=1 # Can be any value
session.timeout.warning=1 # Must set to 1, liferay client needs this to be true to extend session
session.timeout.auto.extend=true # As the key name meant

! REMOVE ANY session-timeout configurations from your portlets and ROOT web.xml

Then after restart the session won’t be expired forever, unless the browser page closed.

Hope there is better solution, but this works.

What if you intend to keep the liferay timeout functions. But just want to have vaadin refresh the session if the user is active on the portlet?

How about using
the Refresher
add-on? It could be easily configured to keep session valid silently until the browser window is closed.

I don’t want the session to run forever until browser close. I want there to be a session that is shared in liferay and in the vaadin portlet. Most of the user activity will be in the vaadin portlet, so i am running into a problem where even though the user is active, they are still getting kicked off by liferay. I guess the session is never being refreshed as they click and navigate around the vaadin portlet. Is there a way i can renew the liferay session for each button click the user makes on vaadin?

The session is automatically shared when using JSR-286 (Portlet 2.0) portlets, including Vaadin ApplicationPortlet2. All requests from the Vaadin UI go via Liferay (most of them as “resource requests” in JSR-286 terminology) before the portlet sees them, so every user action in a Vaadin portlet should automatically be visible to Liferay. In fact, when using JSR-286 strictly, there does not exist any communication channel between the browser and the portlet that would bypass the portal.

If this is not the case, I would consider it a bug - especially if you can reproduce it with a simple Vaadin portlet on a default installation of Liferay, please
file a bug report
, and don’t forget to mention the Vaadin and Liferay versions used.

Note that if using JSR-168 portlets (ApplicationPortlet in Vaadin), there do exist separate sessions for the portlet and the servlet behind it, and these have separate communication channels. In that case, Vaadin tries to get around the problem by explicitly extending the session, but this can be slightly less reliable than the clean approach of JSR-286.

I am having this same problem. We do not want the session to remain open as long as the browser window is open. We would rather have it work as intended, timeout after a certain period of inactivity. Right now if you are active within a vaadin portlet the Liferay session is never extended and it times out. I’m using the latest version of Liferay EE. We just upgraded a few weeks ago. We are also using portlet 2.0 spec with the latest version of Vaadin.

Has anyone got a fix for this that doesn’t involve having the session open as long as the browser window is open.

Okay, I’m running into the same issue running LR 6.0 EE SP2 and Vaadin portlets based upon ApplicationPortlet2… Has anyone opened a bug on this? I’m not sure it’s really a Vaadin bug as looking through the ApplicationPortlet2 and the AbstractApplicationPortlet classes for 6.7.2 they do seem to expect everything to have come through the regular portlet API.

That being said, if I navigate to a page that has a single Vaadin portlet and just use that portlet (no dockbar clicking, no portlet mode changes, etc., just clicking on the Vaadin UI elements within the portlet), eventually the Liferay session times out even though I’m active within the Vaadin portlet…

I’ve downloaded and started the Liferay 6.0.6 CE (with tomcat) package from the liferay website, with the only modifications being:

tomcat/conf/web.xml - removed the session timeout setting
tomcat/webapps/ROOT/WEB-INF/web.xml - removed the session timeout setting
tomcat/webapps/ROOT/WEB-INF/classes/portal-ext.properties - added the following:

session.timeout=2
session.timeout.warning=1
session.timeout.auto.extend=false
session.timeout.redirect.on.expire=true
session.enable.persistent.cookies=true
session.enable.phishing.protection=true

Then, I used the Vaadin plug-in for Eclipse to create a portlet project using Portlet 2.0 and Vaadin 6.7.0.

This sample portlet has a button that auto-updates a label, and nothing more. Clicking the button does not seem to affect the session in any way, and after the given 2 minutes, it expires and logs me out.

Hopefully this simple scenario is enough to show the issue that is being experienced (by myself, at least!) I’ve attached the simple portlet project (vaadin jar was removed for the sake of having a smaller download, please re-add it to WebContent/WEB-INF/lib), hopefully another few sets of eyes on it will either confirm that I’ve done something incorrectly, or that there is in fact a problem somewhere… :slight_smile:
12134.zip (8.11 KB)

Thanks, Cam T. This is a critical issue for me, so I’ve opened a bug on it, hopefully it can be addressed:
Ticket 8305
.

The solution for this problem is to Call the following script from your vaadin application.

private final static String KEEP_LIFERAY_SESSION_ALIVE_SCRIPT =
“if (Liferay.Session._stateCheck) {\n” +
" window.clearTimeout(Liferay.Session._stateCheck);\n" +
" Liferay.Session._stateCheck = null;\n" +
“}\n” +
“Liferay.Session.init({\n” +
" autoExtend: false,\n" +
" timeout: Liferay.Session._timeout,\n" +
" timeoutWarning: Liferay.Session._warning\n" +
“});\n” +
“jQuery.ajax( " +
" {\n” +
" url: Liferay.Session._sessionUrls.extend\n" +
" }\n" +
“);\n”;

It works for me