Bug 56698

Summary: Sessions will be backed up too often by PersistentManager
Product: Tomcat 8 Reporter: Felix Schumacher <felix.schumacher>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.x-trunk   
Target Milestone: ----   
Hardware: All   
OS: All   
Attachments: Add a flag to PersistentManager whether it will save idle sessions once or always
Persist sessions only once while lastAccessedTime is not changed
Simple version of the patch for tomcat 7

Description Felix Schumacher 2014-07-05 15:16:58 UTC
Created attachment 31793 [details]
Add a flag to PersistentManager whether it will save idle sessions once or always

The PersistentManager will save every Session which has not been accessed since maxIdleBackup time on every round.

The attached patch will introduce a flag, so that the admin can decide whether he wants to have the old behaviour, or the more efficient one of only saving sessions once, when they were accessed and idle for maxIdleBackup.

The patch gets a lot simpler, if we just change the behaviour and declare the old one as a bug :)

Tomcat 7 has the same problem and I could provide a patch for it, too.
Comment 1 Mark Thomas 2014-07-06 21:47:42 UTC
Lets go with the more efficient behaviour. I see no good reason to introduce yet another configuration option just to enable inefficient behaviour to continue. Can you provide the simpler patch?
Comment 2 Felix Schumacher 2014-07-07 05:07:19 UTC
Created attachment 31798 [details]
Persist sessions only once while lastAccessedTime is not changed

Simpler version of the previous patch. TestCase is included still.
Comment 3 Felix Schumacher 2014-07-07 05:12:33 UTC
Created attachment 31799 [details]
Simple version of the patch for tomcat 7

Same functionality of the simpler patch for tomcat 7.
Comment 4 Mark Thomas 2014-07-07 13:07:18 UTC
Thanks for the report and for the patches.

This has been fixed in 8.0.x for 8.0.10 onwards and in 7.0.x for 7.0.55 onwards.