AmadeusITGroup / HttpSessionReplacer

Store JEE Servlet HttpSessions in Redis
MIT License
49 stars 33 forks source link

Question - Session gets deleted after 20 seconds of inactivity. How to change the default session timeout? #55

Closed dinbtechit closed 4 years ago

dinbtechit commented 4 years ago

Session gets deleted after 20 seconds of inactivity. Isn't the default time of expiry, 30 mins?

How do we set the session timeout to 30 mins? Passing in the timeout=1800000 argument does nothing...

JAVA_OPTS:

-javaagent:session-agent-0.4.15.jar=timeout=1800000,log=debug

Logs:

09:19:21,549 INFO  [com.amadeus.session.SessionManager] (default task-47) Creating new session with sessionId:  @'UWuQPJGUhs9CPxlWIRrpBx0zePviyM3MUE-j4U4l'
09:20:41,994 INFO  [com.amadeus.session.SessionManager] (pool--0) deleting session with sessionId: 'UWuQPJGUhs9CPxlWIRrpBx0zePviyM3MUE-j4U4l'
09:20:41,995 INFO  [com.amadeus.session.SessionManager] (pool--0) deleting session with sessionId: 'UWuQPJGUhs9CPxlWIRrpBx0zePviyM3MUE-j4U4l'
09:20:41,995 INFO  [com.amadeus.session.repository.inmemory.InMemoryRepository] (pool--0) At 1595866841994 for SessionManager [namespace=] expired sessions [UWuQPJGUhs9CPxlWIRrpBx0zePviyM3MUE-j4U4l]
dinbtechit commented 4 years ago

The session timeout settings in web.xml was overridding the timeout configuration set via JAVA_OPTs. Apparently the session time settings in web.xml was in minutes but the HTTPReplacer filter considers them as seconds. Had to change that configuration from 30 to 1800. To retain the session for 30 mins. Hope this helps for other who ran into similar problem.