Issues
With database-stored sessions, the cf_sessions_data table is not cleaned automatically
Description
Environment
Docker or just installed on CentOS 7 server
relates to
Details
Assignee
Zac SpitzerZac SpitzerReporter
Leon Miller-OutLeon Miller-OutPriority
MajorLabels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
Affects versions
Details
Details
Assignee
Reporter
Priority
Labels
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Sprint
Affects versions
Activity
Zac Spitzer26 March 2025 at 09:06Edited
the interval for purging datasource sessions is only once per hour
but the core problem is, the cleaner only processes thru admin defined datasources, if the datasource is defined in the application.cfc it’s not currently being purged
WORKAROUND
If you are defining the session storage datasource via application.cfc
just add a datasource pointing to that same schema via the admin, with the storage flag enabled and Lucee will purge the expired sessions hourly
Pothys - MitrahSoft25 October 2024 at 12:40
@Leon Miller-Out , I have investigated this ticket on Lucee versions 6.0.3.1-SNAPSHOT and 6.2.0.130-SNAPSHOT with Docker and confirmed that the issue occurred. When I try to set session data after enabling sessionManagement
and sessionStorage
as dataSources with this.sessionTimeout = createTimeSpan(0, 0, 1, 0)
, I notice that the expiry data is not cleared in the cf_session_data
table after 1 minute. However, it does clear the data after restarting Docker.
Leon Miller-Out14 June 2024 at 19:48
@Pothys, unfortunately it's not easy for me to test that right now. Sorry!
Pothys - MitrahSoft4 June 2024 at 13:34
@Leon Miller-Out Could you please try with the Lucee version 6.1.0.175-SNAPSHOT and report back here?
Zac Spitzer2 May 2024 at 08:37Edited
the controller background threads calls this code
if you bump the log level up for the scope.log, you should see all the activity in this area
I thought I had read somewhere that Lucee would prune / trim / clean the
cf_sessions_data
table automatically. However, after running with database-backed sessions for several weeks, the table grew to be very large, with 99% of the records having expires according to theexpires
column.We have created a scheduled task to clean the table, but we shouldn’t have to do that.
FWIW, I can’t find any table cleanup in the code on the 5.4, 6.0, or 6.1 branches.
Possibly related discussion: https://dev.lucee.org/t/client-variables-database-millions-of-entries/8520/1