Irregularity on Session timeout

I’am using Vaadin 7.7.9 and Apache tomcat 9.0.

My goal is expire user session after 12 hours, so, if the user log on the system at 8am, the session must expire around 6pm. But the session is expiring between 3.5pm and 4.5pm. Some times session expires after 15-30 minutes. Why my session is not expiring after 12 hours ?

Vaadin servlet parameters on servlet class:
@VaadinServletConfiguration(productionMode = true, ui = com.dokcloud.DokcloudUI.class, heartbeatInterval = -1, closeIdleSessions = true)

On my UI class on init method:
DokcloudUI.getCurrent().getSession().getSession().setMaxInactiveInterval(43200); – 12 hours

The system is being publicated on elastic bean stalk (aws).

Thanks for all,
Best regards

Thanks for the comment. On aws load balancer the config is set to about 8 hours to expire. Probably this is the problem. Thanks for the answer. I will continue to test.

Thanks for all

You can safely remove the closeIdleSessions in your setup since it is only effective when heartbeatInterval is 1 or greater. Since heartbeatInterval is disabled, Vaadin will not ping your server and will not manage your session. It should therefore be left to Tomcat to handle the session management.

However, AWS’s load balancer may come into play. I’m guessing that the load balancer is configured with sticky sessions - that is, particular user is redirected always to the same server which then hosts the session. This has the advantage that the session does not need to be replicated between cluster nodes. However, if the session times out at the load balancer, it may perceive user’s request as a completely new session and may redirect it to the different node which doesn’t have that session and thus it also perceives the request as a new login.

Take a look at AWS’s load balancer configuration - namely, for how long will it remember the session-id-to-server-node lease.