Заполнение пользователем .cagefs / tmp / с тысячами файлов сеанса
Форум
  1. Forums
  2. CloudLinux and Control Panels
  3. CloudLinux and cPanel
  1. Scott Neader
  2. Tuesday, 06 October 2015
  3.  Subscribe via email
I was looking into a disk usage issue for a customer and found that they had nearly 1 GB of  temporary session files stored in /home/user/.cagefs/tmp/

In fact, there are currently nearly 197,000 of these files... some with today's date... some over 4 months old.  The files all look like this:

-rw------- 1 username username       75 Jul  5 15:56 sess_fffcd441337ca45a72f1fd314756ec51
-rw------- 1 username username       96 Jul 20 16:07 sess_fffce04195a58c07cff8a0be35a7be03
-rw------- 1 username username       96 Aug 23 08:25 sess_fffd1e490ef386faf741e79f6ee3f964
-rw------- 1 username username       75 Jun 14 00:25 sess_fffd35f8eb321c6e034c02e4cafd6ce9
-rw------- 1 username username       75 Oct  1 23:43 sess_fffd8c5e81f81b1bccad9c06d0b1fffa


Sure, i can clear these files out, but this is masking a larger problem.

1) Why are these files here?
2) Should they be here?
3) How can they be automatically purged to stop this from happening to this or other customers in the future?

Thanks for any insight you can provide.

- Scott
Rate this post:
  1. 10.11.2015 11:11:24
  2. # 1
Mike Vasquez Accepted Answer
Posts: 6
Joined: 29.06.2012
0
Votes
Undo
Open /usr/share/cagefs/cagefsctl.py and find def tmpwatch():
Replace string (line 3922 in cagefs-5.5-6.4.el6.cloudlinux.x86_64):
subprocess.call(cmd, stderr=dev_null, stdout=dev_null)
with this code, saving correct identing for python:
if VERBOSE:
     subprocess.call(cmd)
else:
     subprocess.call(cmd, stderr=dev_null, stdout=dev_null)
Then run:
cagefsctl -v --tmpwatch
Output of this command should help you to fix the problem.
  1. 10.11.2015 11:11:51
  2. # 2
Bogdan Accepted Answer
Posts: 709
Joined: 26.06.2013
0
Votes
Undo
It's not Ok to perform any modifications to source code, answering your questions:

1) Why are these files here?
2) Should they be here?
This depends from PHP and used softoware configuration, some websites could be configured to store session files in mysql databases, however by default all session files are in /tmp/ .

3) How can they be automatically purged to stop this from happening to this or other customers in the future?
CageFS do watch users tmp however it remove files that was not accessed in 30 days. This means if website is popular and it has 197,000 active users (those who log to site in past 30 days) session files will not be removed.


First, try launching 'cagefsctl --tmpwatch' as is and check number of files, maybe this command was not executed. If files stays untouched - check access time for some of them ( stat /home/username/.cagefs/tmp/sess_xxyyzz ).

You may also reconfigure this process to remove files by modification time, cagefs use standard tmpwatch syntax. More: http://docs.cloudlinux.com/tmp_directories.html
  1. 10.11.2015 12:11:24
  2. # 3
Scott Neader Accepted Answer
Posts: 89
Joined: 12.06.2014
0
Votes
Undo
Bogdan, this is a known bug.  See Ticket: #JUX-649-26138


Hello!

I have found a bug in cagefsctl --tmpwatch command
It will be fixed in the next release of CageFS

Thank you for reporting the issue


Anton Volkov,
Developer,
Cloud Linux Inc.

This problem is STILL not fixed, by the way.  I do not know what release of "CageFS" will fix this... do you know?

- Scott
  1. 10.11.2015 13:11:20
  2. # 4
Mike Vasquez Accepted Answer
Posts: 6
Joined: 29.06.2012
0
Votes
Undo
Of course before such ugly way of detecting the problem, you should backup original file and after debugging, you should return it back.
In our case, after enabling \"verbose\" of tmpwatch we found out two problems:
- wrong permissions on user\'s home directory, /home/username
- wrong permissions and owner on ~username/.cagefs/tmp
After fixing it - tmpwatch works perfect.

Bogdan, it\'d be good to implement verbosing for tmpwatch and catch exit code of running tmpwatch in user\'s lve.
  1. 10.11.2015 15:11:57
  2. # 5
Bogdan Accepted Answer
Posts: 709
Joined: 26.06.2013
0
Votes
Undo
I was just informed by our developers that indeed that is caused by a bug, most probably we will release a hotfix this week. Internal case number that will be listed in release notes: CAG-392
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!
гость
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below. Supports gif,jpg,png,zip,rar,pdf
• Insert • Remove Upload Files (Maximum File Size: 2 MB)
Captcha
To protect the site from bots and unauthorized scripts, we require that you enter the captcha codes below before posting your question.