Bug 48973

Summary: Don't create SESSIONS.ser when no session exists
Product: Tomcat 6 Reporter: Marc Guillemot <mguillemot>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement CC: mguillemot
Priority: P2    
Version: 6.0.26   
Target Milestone: default   
Hardware: PC   
OS: Linux   
Attachments: Patch skiping SESSIONS.ser file creation if no session exists

Description Marc Guillemot 2010-03-24 09:22:46 UTC
Created attachment 25171 [details]
Patch skiping SESSIONS.ser file creation if no session exists

When a webapp is unloaded, a SESSIONS.ser file is created even if no session exists for the application. This is useless.
Comment 1 Sylvain Laurent 2010-12-03 17:03:53 UTC
Patch applied on trunk, it will be available for tomcat 7.0.6.
Backport to tomcat 6 proposed.
Comment 2 Marc Guillemot 2010-12-08 06:44:40 UTC
In fact the patch was incomplete and applying it as it introduces a bug: if no session exist, no SESSIONS.ser should be created AND previous SESSIONS.ser should be deleted (if any old file exists).
Comment 3 Konstantin Kolinko 2010-12-08 08:47:30 UTC
(In reply to comment #2)
AFAIK, the SESSIONS.ser file is deleted in StandardManager.doLoad() upon successful or unsuccessful attempt to read it. Do you have a scenario where a stale SESSIONS.ser file is left behind?
Comment 4 Marc Guillemot 2010-12-08 08:57:37 UTC
(In reply to comment #3)

I hadn't checked doLoad(). I was only thinking that not writing a file with 0 sessions could have a consequence. I think that you're right and that no problem should occur.
Comment 5 Mark Thomas 2011-01-08 14:16:04 UTC
Thanks again for the patch.

This has been applied to 6.0.x and will be included in 6.0.30 onwards.