Bug 48973 - Don't create SESSIONS.ser when no session exists
Summary: Don't create SESSIONS.ser when no session exists
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.26
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2010-03-24 09:22 UTC by Marc Guillemot
Modified: 2011-01-08 14:16 UTC (History)
1 user (show)

Patch skiping SESSIONS.ser file creation if no session exists (644 bytes, text/plain)
2010-03-24 09:22 UTC, Marc Guillemot

Note You need to log in before you can comment on or make changes to this bug.
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.