vesta icon indicating copy to clipboard operation
vesta copied to clipboard

Session files not being removed

Open franciscopaniskaseker opened this issue 7 years ago • 4 comments

Operating System (OS/VERSION):

root@painel:~# cat /etc/issue Debian GNU/Linux 8 \n \l

root@painel:~# uname -a Linux ****** 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux

VestaCP Version:

root@painel:~# dpkg -l | egrep -i vesta ii vesta 0.9.8-17 amd64 Vesta ii vesta-nginx 0.9.8-16 amd64 Vesta Nginx ii vesta-php 0.9.8-17 amd64 Vesta php-fpm

Installed Software (what you got with the installer):

(apache+nginx) + php + exim + bind + devecot + iptables

Steps to Reproduce:

Default installation without any vestacp customized configuration.

Yesterday that server had 100% inode usage and all user services stopped to work. I saw 3 millions of php session files created and not removed. So, because everything stopped to work, I removed some of them manually with:

find /home/*/tmp -type f -name 'sess_*' -ctime +5 -delete

Related Issues/Forum Threads:

I found same question here: https://forum.vestacp.com/viewtopic.php?t=10266

I observed session.gc_probability configuration is zero (default vestacp configuration), but I really think we can not use zero in this configuration.

; Defines the probability that the 'garbage collection' process is started ; on every session initialization. The probability is calculated by using ; gc_probability/gc_divisor. Where session.gc_probability is the numerator ; and gc_divisor is the denominator in the equation. Setting this value to 1 ; when the session.gc_divisor value is 100 will give you approximately a 1% chance ; the gc will run on any give request. ; Default Value: 1 ; Development Value: 1 ; Production Value: 1 ; http://php.net/session.gc-probability

And I found that value is 1 on sources: https://github.com/serghey-rodin/vesta/blob/0.9.8-9/src/rpm/conf/php.ini

Other Notes:

I changed manually session.gc_probability to 1 and restarted nginx/apache and now I am seeing 1.4mi of php session files at /home/admin/tmp/ decreased to 129703. I think its too much either, but much better of course.

franciscopaniskaseker avatar Aug 15 '17 14:08 franciscopaniskaseker

I had the exact same issue. A LOT of sess_* files under many tmp directories

I'll switch session.gc_probability to 1 and hope it helps

beraldo avatar Aug 24 '17 19:08 beraldo

I have the same issue, is the session.gc_probablity to 1 the only option out there?

CzarnaMamba avatar Apr 09 '20 00:04 CzarnaMamba

I have the same issue, facing since last year. Tried many ways to delete the temp files, but that not letting me delete that files.

mohammadimranora avatar Mar 15 '21 05:03 mohammadimranora

Today I found that session creation stopped working and i found it was due to many session files into tmp directory. Due to inodes issues I used gc_probability=1 but it didn't resolved issue. You may use following code and add a cron based on your need

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
find /home/admin/tmp -mmin +30 -exec rm {} \;

lianglee avatar Dec 29 '21 15:12 lianglee