Author Topic: too many Cache files make system crashed  (Read 836 times)

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
too many Cache files make system crashed
« on: April 05, 2018, 12:31:30 AM »
I have 1079 categories and 31500 products. My website was crashed 3 times after I have set up the website 3 weeks ago.
I find that there are too many temp. files in the /tmp folder (sess_*). The first 2 times made the website stopped more than 30 minutes.
After I had cleared all the temp. files in /tmp, it worked again.
But this time, my debian server is crashed. After I reboot the server, the apache, mysql, email, ftp can't be started, the server hard disk becomes read only.
I have remount the hard disk with read/write manually and remove the disk quota in the /etc/fstab. Then the server can boot up properly.
I don't know what is the really problem causes this happened. But I think that if abantecart can create some sub-folders to store the temp. files, then it may solve some problems. (For exmaple, create sub-folder /tmp/sess_00/, /tmp/sess_01/, /tmp/sess_a0/, /tmp/sess_aa/, /tmp/sess_zz/, .....  and put the temp. files sess_01xxxxxxxxxx to /tmp/sess/01, files sess_aaxxxxxxx to /tmp/sess_aa/ , etc).
Hope that abantecart can improve it.
Thank you.

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1782
  • Karma: +247/-11
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: too many Cache files make system crashed
« Reply #1 on: April 05, 2018, 04:50:47 AM »
Hello.
it's a server side configuration issue, not AbanteCart.

Please read this doc about php garbage collector
https://www.dev-metal.com/how-the-php-session-garbage-collector-really-works/
You should tune up your php.ini
« Last Edit: April 05, 2018, 06:26:04 AM by abantecart »
“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
Re: too many Cache files make system crashed
« Reply #2 on: April 05, 2018, 05:38:16 AM »
Yes. The problem seems not caused by abantecart. The temp. files are in /system/cache folder. But It doesn't have this problem by using other shopping cart. I need to investigate it.
Thank you for your information.

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
Re: too many Cache files make system crashed
« Reply #3 on: April 05, 2018, 06:06:43 AM »
this is the content in the sessions file
session_mode|s:0:"";LAST_ACTIVITY|i:1522909627;language|s:2:"en";country_id|i:0;zone_id|i:0;customer_group_id|s:1:"1";cart|a:0:{}currency|s:3:"HKD";
It generates 8200 sessions files in 6 hours. Can I modify abantecart to kill the sessions in a shorter time or just need to modify the session.gc-maxlifetime in php.ini?

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4153
  • Karma: +251/-9
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: too many Cache files make system crashed
« Reply #4 on: April 05, 2018, 06:28:16 AM »
You can set session.gc_max_lifetime = 0 and it will kill all the sessions.

ini_set('session.gc_max_lifetime', 0);
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 1);
We need your help to build better free open source eCommerce platform for everyone.
See how you can help

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1782
  • Karma: +247/-11
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: too many Cache files make system crashed
« Reply #5 on: April 05, 2018, 07:02:21 AM »
Can I modify abantecart to kill the sessions in a shorter time or just need to modify the session.gc-maxlifetime in php.ini?

yes, you can modify index.php and paste at the beginning
Code: [Select]
ini_set('session.gc_divisor',1);  //will run garbage collector on each session start
ini_set('session.gc_maxlifetime',30);  //will set session expiration to 30 seconds

or add this directives into your php.ini

See more details here http://php.net/manual/en/session.configuration.php#ini.session.gc-probability

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline smallfish

  • Full Member
  • ***
  • Posts: 129
  • Karma: +15/-2
    • View Profile
Re: too many Cache files make system crashed
« Reply #6 on: April 05, 2018, 11:11:46 PM »
The number of seesions temp. files are accumulated to 60K overnight. Then it makes abantecart stop running again. I have added the session.gc_max_lifetime setting both in php.ini and index.php. I think that abantecart cart also need to consider this problem. It can make abantecart stop to run or make server crashed.

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 1782
  • Karma: +247/-11
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: too many Cache files make system crashed
« Reply #7 on: April 06, 2018, 05:48:42 AM »
The number of seesions temp. files are accumulated to 60K overnight. Then it makes abantecart stop running again. I have added the session.gc_max_lifetime setting both in php.ini and index.php. I think that abantecart cart also need to consider this problem. It can make abantecart stop to run or make server crashed.

Nope, garbage collector tunes up by server configuration. AbanteCart just an application that works under it. Btw you can check php-envoronment via admin menu->system->settings->system -> phpinfo() to be sure your changes of php.ini was applied.
But you should to tune up your server manually. Php software cannot regulate platform it working on. We just can to suggest some tricks for best perfomance.

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

 

Powered by SMFPacks Social Login Mod