1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

High load after plesk 11 update find and fuser

Discussion in 'Plesk 11.x for Linux' started by Webroy, Jul 17, 2012.

  1. Webroy

    Webroy Regular Pleskian

    26
    23%
    Joined:
    Oct 29, 2008
    Messages:
    156
    Likes Received:
    0
    After the update of plesk 10 to plesk 11 i see a lot of find and fuser in top.

    Is this process hanging in plesk 11 ?

    /etc/cron.hourly/plesk-php-cleanuper: find /var/lib/php/session -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/plesk-9.0/maxlifetime) ! -execdir fuser -s {} \; -delete 2> /dev/null

    fuser -s ./sess_vhl5jka546prfj7vj1l9s0lsn3

    and a lot of find in /var/lib/php/session.

    This happend directly after the update from 10.4 to 11.
     
  2. abdi

    abdi Platinum Pleskian

    31
    18%
    Joined:
    May 14, 2006
    Messages:
    2,913
    Likes Received:
    60
    For starters, try

    rm -fdr /var/lib/php/session/*

    and then

    chmod -R 1777 /var/lib/php/session
     
  3. Webroy

    Webroy Regular Pleskian

    26
    23%
    Joined:
    Oct 29, 2008
    Messages:
    156
    Likes Received:
    0
    Yes did that... and that worked so far, but why cant plesk 11 cleanup the sessions?
     
  4. AmerSaeed

    AmerSaeed Guest

    0
     
    getting this error while executing rm

    -bash: /bin/rm: Argument list too long
     
  5. Nikolay.

    Nikolay. Silver Pleskian

    17
    35%
    Joined:
    Jul 1, 2012
    Messages:
    844
    Likes Received:
    2
    Because this is obviously a destructive operation. It is potentially harmful to remove fresh sessions.
     
  6. abdi

    abdi Platinum Pleskian

    31
    18%
    Joined:
    May 14, 2006
    Messages:
    2,913
    Likes Received:
    60
    This could help: http://www.simplehelp.net/2009/02/18/linux-tip-overcoming-the-binrm-argument-list-too-long-error/

    However, personally whenever I get that error most times its as a result of SeLinux being enabled due to restricted file permissions on the server you can't execute that command...

    Solution could be

    setenforce 0

    and if the above fails, then try disabling SELinux permanently by:

    vim /etc/selinux/config
    SELINUX=enforcing
     
  7. PeteyC

    PeteyC Guest

    0
     
    I've seen this problem on a busy server. Symptoms:

    * old files in /var/lib/php/session aren't removed despite this script
    * high latency on file operations due to the growing 'session' directory size
    * hourly high load average due to many fuser processes

    The reason: find 'execdir' appears to have a bug where it doesn't release file handles. It quickly runs into the default maximum of 1024 and the find process quits. So it deletes some files, but not all. In the case I saw, it was deleting them more slowly than they were accumulating.

    The solutions... in /etc/cron.hourly/plesk-php-cleanuper, either:

    * raise the limit on open files with e.g. "ulimit -n 102400", before the find command. OR

    * change "-execdir" to "-exec", which doesn't have this bug (if you have untrusted users on your machine be aware of the security implication of -exec... read the manpage). OR

    * remove the section "! -execdir fuser -s {} \;" entirely. It's just checking whether any process has the file open at the moment. This won't - and shouldn't - prevent it from being deleted, and subsequent accesses by httpd will just find that the session has been deleted. perfect. So the complete line would be:
    Be aware that after you make any of these changes, then the first time this script runs and works on a large directory (e.g. 1million+ files), you could bring your server to its knees for some time as it chews over all those delete operations. I wrote a one-off script to remove them gradually in the background before installing the corrected version of plesk-php-cleanuper.
     
  8. MislavO

    MislavO Regular Pleskian

    16
    85%
    Joined:
    Jul 20, 2012
    Messages:
    271
    Likes Received:
    1
    Location:
    Croatia
    I have one stupid question, since i don't have folder /var/lib/php/session, i have /var/lib/php5/sess_XX (XX - name of files), I guest that is same thing right, or?
     
  9. PeteyC

    PeteyC Guest

    0
     
    Sure, they are also session files, but the script we were talking about from plesk 11 ("plesk-php-cleanuper") is not going to touch them.
     
  10. MislavO

    MislavO Regular Pleskian

    16
    85%
    Joined:
    Jul 20, 2012
    Messages:
    271
    Likes Received:
    1
    Location:
    Croatia
    Great, thanks for fast answer (i'm also using Plesk 11).
     
Loading...