Ticket #583 (closed defect: fixed)
tmp files on parrot exceeded inode limit
Reported by: | ed | Owned by: | chris |
---|---|---|---|
Priority: | major | Milestone: | Maintenance |
Component: | Parrot server | Keywords: | |
Cc: | laura | Estimated Number of Hours: | 0.0 |
Add Hours to Ticket: | 0 | Billable?: | yes |
Total Hours: | 1.5 |
Description
Users are attempting to purchase a DVD and the cart always zeros out even after attempts to update cart etc.
Laura suggests that this may be a server issue and to start with Chris:
The prob could v likely be on the hosting side, so be worth contacting Chris first (and mention can add to cart all okay when logged in, view cart and alter and get to billing page, so could be a session setting that's changed) -
- Does the server have disk space left on /tmp. Session data is most likely written there. (sometimes this cart faff issue can happen because of that.)
- Are the PHP Session settings correct/ have they changed recently? Chris can fix this if needing a tweakette in php.ini or other places in the underworld of those types of files.
- DB could potentially need check/repair.
Another one is the shop element relies on cookies so if a user has set browser to not accept cookies may poss not work! (but think thats something not to think about here, as I tested as both logged in and logged out with cookies set to work on my browser, logged out got the 'cart empty' faff factor like other users will be getting.)
If Chris can't spot the bug (does sound server side and sessions related from a quick test here, haven't looked at the server logs, but if get a mo later will see if I can), poss good to chat and I can think some more on it, but first thoughts alert me mostly to server side, sometimes a roll back to php 5.2 clicks things back into place (but shouldn't be needed). Be good to see if there is a correlation with any server changes/tweaks happening around same timing that the cart stopped working. Keep me in the loop if it is a server fix-y thing as always interested to hear results on bug fixing on sites.
Change History
comment:1 Changed 3 years ago by chris
- Cc laura added
- Add Hours to Ticket changed from 0.0 to 0.5
- Status changed from new to accepted
- Total Hours changed from 0.0 to 0.5
comment:2 Changed 3 years ago by chris
- Add Hours to Ticket changed from 0.0 to 0.25
- Total Hours changed from 0.5 to 0.75
The server had run out of inodes (see https://en.wikipedia.org/wiki/Inode ), not diskspace, there were over 1/2 a million tmp session files:
269711 ./movie/tmp 294284 ./recon/tmp
There is now lots of free inodes:
df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/xvda2 655360 40647 614713 7% / tmpfs 261355 4 261351 1% /lib/init/rw udev 253188 384 252804 1% /dev tmpfs 261355 3 261352 1% /dev/shm /dev/xvda3 589824 28674 561150 5% /home
I have added a daily cron job to delete all tmp files that are more than 7 days old:
01 06 * * * find /home/*/tmp/* -mtime +7 -exec rm {} \;
I have added a section to the wiki about this, wiki:ParrotServer#tmpfiles
I think that resolves this issue?
comment:3 Changed 3 years ago by chris
- Add Hours to Ticket changed from 0.0 to 0.25
- Total Hours changed from 0.75 to 1.0
- Summary changed from Problem with intransition movie site shopping cart to tmp files on parrot exceeded inode limit
For reference the number of inodes on the /home aka /dev/xvda3 partition is 589,824 and this is the limit that was hit:
tune2fs -l /dev/xvda3 ... Filesystem OS type: Linux Inode count: 589824 Block count: 2359296 Reserved block count: 117964 Free blocks: 1551253 Free inodes: 561780 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 575 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512
We could consider creating a new partition just for tmp files with a inode count of several million if there is an issue with tmp session files being deleted after a week -- is this a problem, does it cause people to be logged out?
comment:4 Changed 3 years ago by ed
Good work Chris - thanks.
I'm going to ask Laura to have a scan of this ticket - to developer-sense-check it - and see how/if it ties in with the larger piece of work around the whole site and updating it - which would need separate budget from TN...
comment:5 Changed 3 years ago by chris
- Add Hours to Ticket changed from 0.0 to 0.5
- Status changed from accepted to closed
- Resolution set to fixed
- Total Hours changed from 1.0 to 1.5
The cronjob failed last night:
From: root@parrot.webarch.net (Cron Daemon) Date: Thu, 12 Sep 2013 06:01:01 +0100 To: root@parrot.webarch.net Subject: Cron <root@parrot> find /home/*/tmp/* -mtime +7 -exec rm {} \; (failed) /bin/sh: find: Argument list too long
It also failed when piping to rm:
find /home/*/tmp/* -mtime +7 | xargs rm -rf -bash: /usr/bin/find: Argument list too long
And ls fails when trying to count the files:
ls /home/*/tmp/* | wc -l -bash: /bin/ls: Argument list too long 0
Debian has a package called tmpreaper, so:
aptitude install tmpreaper ; logchange "tmpreaper: installed"
The /etc/tmpreaper.conf file was edited and these values were set:
TMPREAPER_DIRS='/home/*/tmp/.' TMPREAPER_TIME='7d'
And it was tested on the command line:
/etc/cron.daily/tmpreaper error: Cannot chdir() to `/home/*/tmp/.' for --protect glob: No such file or directory
So we have to specify the directories without a wild card:
TMPREAPER_DIRS='/home/recon/tmp/. /home/movie/tmp/.'
And it was run again and then the number of files remaining was countable again:
/etc/cron.daily/tmpreaper ls /home/*/tmp/* | wc -l 42963
And the documentation has been updated, wiki:ParrotServer#tmpfiles
There is an issue with disk space on /home -- files can't be created:
However df doesn't report a problem:
There are a lot of tmp files that can be deleted:
These seem to be tmp session files that don't get deleted, there are a lot of them:
So deleting the tmp files that are more than a day old:
Hopefully this will fix it for now, but more work is needed on this.