Summary: | cgisess_ files polluting the /tmp directory | ||
---|---|---|---|
Product: | Koha | Reporter: | Blou <philippe.blouin> |
Component: | Authentication | Assignee: | Blou <philippe.blouin> |
Status: | CLOSED FIXED | QA Contact: | Marcel de Rooy <m.de.rooy> |
Severity: | minor | ||
Priority: | P5 - low | CC: | brendan, dpavlin, eric.begin, f.demians, francois.charbonnier, jonathan.druart, julian.maurice, m.de.rooy, magnus |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18578 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 15553 - cgisess_ files polluting the /tmp directory
Bug 15553 - [SIGNED-OFF] cgisess_ files polluting the /tmp directory Bug 15553 - [SIGNED-OFF] cgisess_ files polluting the /tmp directory Bug 15553: [QA Follow-up] Replace hardcoded tmp and add instance to dirname |
Description
Blou
2016-01-11 21:40:59 UTC
Created attachment 46503 [details] [review] Bug 15553 - cgisess_ files polluting the /tmp directory When some users want to improve performance, one suggestion is to switch the syspref "sessionstorage" to 'tmp', which store the session info in the /tmp directory instead of the database. Depending on the frequency of the cleaning process (or lack thereof), this can be heavy pollution into the /tmp directory, making it unusable. "rm cgi*" would not even work since cgi* extends to over 8000 items... A simple fix is to modify the target directory in C4/Auth.pm to /tmp/cgisess. Testing scenario: 1) change the syspref SessionStorage to 'tmp' 2) Log into the OPAC, validate that a file named /tmp/cgisess_(something) got created 3) Apply the patch 4) Log into the OPAC, validate that a file /tmp/cgisess/cgisess_(something) got created My initial plan was to have some value specific to each library (when multiple libraries on a server), but I didn't want to add a syspref, nor could I find an easy, meaningful value to reuse. Deleting the dir poses no problem, since CGI:Session creates the directory when needed, owned by www-data (or equivalent). I only tested on Ubuntu & Debian. No Windows. I added that for our benefit, thought it might be useful to others. No biggie if no one's interested :) Too many /tmp/cgisess* files for a simple rm can also come as an unpleasant surprise if you have Koha set up to use memcached for sessions, and memcached dies for some reason. Bam, next morning your disk is full... Created attachment 46559 [details] [review] Bug 15553 - [SIGNED-OFF] cgisess_ files polluting the /tmp directory When some users want to improve performance, one suggestion is to switch the syspref "sessionstorage" to 'tmp', which store the session info in the /tmp directory instead of the database. Depending on the frequency of the cleaning process (or lack thereof), this can be heavy pollution into the /tmp directory, making it unusable. "rm cgi*" would not even work since cgi* extends to over 8000 items... A simple fix is to modify the target directory in C4/Auth.pm to /tmp/cgisess. Testing scenario: 1) change the syspref SessionStorage to 'tmp' 2) Log into the OPAC, validate that a file named /tmp/cgisess_(something) got created 3) Apply the patch 4) Log into the OPAC, validate that a file /tmp/cgisess/cgisess_(something) got created Signed-off-by: Magnus Enger <magnus@libriotech.no> Works as advertised. Session files are created in /tmp/cgisess/ instead of directly in /tmp. I usually store sessions in memcached, but a couple of times memcached has died on me, and before I knew it, /tmp was so full of sessions files, I could not easily delete them with "rm /tmp/cgisess*". Being able to delete /tmp/cgisess/ should be a bit easier. Created attachment 46572 [details] [review] Bug 15553 - [SIGNED-OFF] cgisess_ files polluting the /tmp directory When some users want to improve performance, one suggestion is to switch the syspref "sessionstorage" to 'tmp', which store the session info in the /tmp directory instead of the database. Depending on the frequency of the cleaning process (or lack thereof), this can be heavy pollution into the /tmp directory, making it unusable. "rm cgi*" would not even work since cgi* extends to over 8000 items... A simple fix is to modify the target directory in C4/Auth.pm to /tmp/cgisess. Testing scenario: 1) change the syspref SessionStorage to 'tmp' 2) Log into the OPAC, validate that a file named /tmp/cgisess_(something) got created 3) Apply the patch 4) Log into the OPAC, validate that a file /tmp/cgisess/cgisess_(something) got created Signed-off-by: Magnus Enger <magnus@libriotech.no> Works as advertised. Session files are created in /tmp/cgisess/ instead of directly in /tmp. I usually store sessions in memcached, but a couple of times memcached has died on me, and before I knew it, /tmp was so full of sessions files, I could not easily delete them with "rm /tmp/cgisess*". Being able to delete /tmp/cgisess/ should be a bit easier. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 46573 [details] [review] Bug 15553: [QA Follow-up] Replace hardcoded tmp and add instance to dirname If you use multiple instances on one server, you could have the situation that instance A creates the cgisess subfolder and instance B could have a permission problem. This patch resolves that by allowing each instance to have its own cgisess subfolder. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> QA Comment: Looks good to me, adding the multiple instance case. Another report could deal with cleaning up this folder. Why not remove all older session files in cleanup_database.pl on daily basis? Passed QA Note that users will be logged out. Pushed to Master - Should be in the may 2016 Release. Thanks! Patch pushed to 3.22.x, will be in 3.22.3 This patch has been pushed to 3.20.x, will be in 3.20.9. |