Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fuser process php5 cron job using high amounts of cpu

We are seeing our server's CPU spike at 30 minute intervals. this is likely caused by php5 job to cleanup session files. this is taken from our /etc/cron.d/php5 on the server:

# /etc/cron.d/php5: crontab fragment for php5
#  This purges session files older than X, where X is defined in seconds
#  as the largest value of session.gc_maxlifetime from all your php.ini
#  files, or 24 minutes if not defined.  See /usr/lib/php5/maxlifetime

# Look for and purge old sessions every 30 minutes
09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -ignore_readdir_race -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete

there seems to have been a problem with this job in past releases. there was a problem in version 11.10 of Ubuntu with this taking high amounts of CPU but we are running much later builds of both Ubuntu and PHP. how important is this job for PHP? can we stop this job from running or lower its priority?

like image 864
user2708100 Avatar asked Dec 23 '13 11:12

user2708100


1 Answers

This is a bug, it appears to be realted to the pmisc package but is also part of the php5 when php5-apc is functional.
There is an ubuntu bug report and suggested workaroud mentioned here: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/876387

09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) -delete

and a Debian bug report here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=633100

I have tested the workaround on debian wheezy and it works, although updating the package would be better!

like image 92
FGiorlando Avatar answered Sep 19 '22 01:09

FGiorlando