Skip to content

SessionListener attempts to remove session from distributed storage #142

@jorgheymans

Description

@jorgheymans

In my attempts to isolate behaviour for https://vaadin.com/forum/t/continous-deployment-and-vaadin/167127/15 , I noticed that SessionListener attempts to delete the session from distributed storage during shutdown of the application. It fails to do so however as the Spring application context is closed by the time the listener is invoked.

I have 2 remarks on this:

  • when the instance is shut down, and the user with said session cookie closes the browser before interacting with the application again, is associated session data in redis effectively orphaned ? (EDIT i guess this is described here Allow backend connector to apply expiration policies based on HTTP session timeout #126)
  • why does the session need to be removed from redis here, as another application instance could resume serving the user and hence would need that session data to be present ?
Unable to delete data with key fe213d5a-198f-4719-a31f-de08fddef39d from distributed storage associated to session 9EA09A9E52C4FAF243F281FB4C85876D

java.lang.IllegalStateException: LettuceConnectionFactory was destroyed and cannot be used anymore
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.assertStarted(LettuceConnectionFactory.java:1447) ~[spring-data-redis-3.3.4.jar!/:3.3.4]
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:1045) ~[spring-data-redis-3.3.4.jar!/:3.3.4]
	at com.vaadin.kubernetes.starter.sessiontracker.backend.RedisConnector.deleteSession(RedisConnector.java:94) ~[kubernetes-kit-starter-2.2.2.jar!/:2.2.2]
	at com.vaadin.kubernetes.starter.sessiontracker.SessionListener.lambda$sessionDestroyed$0(SessionListener.java:104) ~[kubernetes-kit-starter-2.2.2.jar!/:2.2.2]
	at java.base/java.util.Optional.ifPresent(Optional.java:178) ~[na:na]
	at com.vaadin.kubernetes.starter.sessiontracker.SessionListener.sessionDestroyed(SessionListener.java:99) ~[kubernetes-kit-starter-2.2.2.jar!/:2.2.2]
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:629) ~[tomcat-embed-core-10.1.30.jar!/:na]
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:571) ~[tomcat-embed-core-10.1.30.jar!/:na]
	at org.apache.catalina.session.StandardManager.stopInternal(StandardManager.java:384) ~[tomcat-embed-core-10.1.30.jar!/:na]
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:231) ~[tomcat-embed-core-10.1.30.jar!/:na]
	at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:4644) ~[tomcat-embed-core-10.1.30.jar!/:na]
	at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:231) ~[tomcat-embed-core-10.1.30.jar!/:na]
	at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1219) ~[tomcat-embed-core-10.1.30.jar!/:na]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions