Session cleaner takes long and slows host

  • Hi,
    you know there is a cron job related to php which clean sessions, which code is this:

    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 -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null ; -delete

    As the comment says, it runs every 30 minutes. The problem is that it is taking a long time, more than the 30 minutes, so another process is launched. And this on an on. So the host get slow. But didn’t happen before so I am wondering if it has something to do with a bug in fog session management.

    Can it be possible?



  • Ok, thanks a lot Junkhacker I will change it.

  • Developer

    this is a known bug in ubuntu’s config. it’s running fuser for each PHP session file easily racking up thousands of processes. edit /etc/cron.d/php5 line [CODE]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) ! -execdir fuser -s {} 2>/dev/null ; -delete[/CODE] to be [CODE]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[/CODE]

  • Thanks Tom. I also found that page and I was trying to implement memcache :)
    At the moment is actually fast but sessions expire too soon I don’t know why.
    Thanks anyway for your quick response.


  • Senior Developer

  • Senior Developer

    I suppose it’s possible, but I haven’t done any major session changes in a LONG time.

Log in to reply





Looks like your connection to FOG Project was lost, please wait while we try to reconnect.