Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expired session files #4113

Closed
lonalore opened this issue Mar 27, 2020 · 8 comments
Closed

Expired session files #4113

lonalore opened this issue Mar 27, 2020 · 8 comments
Labels
topic: documentation type: enhancement An improvement or new feature request type: question An ask about behavior that is not found documented anywhere

Comments

@lonalore
Copy link
Member

lonalore commented Mar 27, 2020

Question

Is there a way in e107 to clean up expired session files from temp dir?

Additional Context

I have a VPS with multiple websites, and yesterday I got an alert about 90% usage of inodes. After a little exploration I found that there are more than thousands of e107 session files in the temp directory took ~1.5 million inodes. The directory contained not only new but also old session files even though "Session lifetime" is set to 86400 in the Admin area.

There is only one e107 website on my VPS, other websites do not have this problem. Any idea about this?

Additional Info

  • Cron is set and it runs every minute.
  • PHP 7.1.29 (Fast-CGI)
  • Apache webserver
  • e107 version: latest git version

2020-03-27_15-05-30

@lonalore lonalore added the type: question An ask about behavior that is not found documented anywhere label Mar 27, 2020
@Deltik
Copy link
Member

Deltik commented Mar 27, 2020

@CaMer0n: This is exactly what I predicted could happen in our private conversation on 17 February 2020 (link only works for you and @Moc).


@lonalore: The immediate solution is to enable PHP session file garbage collection in your php.ini file. These configuration options need to be greater than 0:

  • session.gc_maxlifetime – should match your intended session lifetime in minutes
  • session.gc_divisor – should more than 0 up to 100

Depending on your web server configuration, your web server may need to be restarted after changing php.ini.

In the future, I am planning on introducing a new session management model in e107. Specifically, I want to make it possible to store sessions in the MySQL database, which takes up only 1 to 3 inodes for all sessions, no matter how many.

@Deltik Deltik self-assigned this Mar 27, 2020
@lonalore
Copy link
Member Author

lonalore commented Mar 27, 2020

@Deltik thank you, I'll apply this setting soon for that website.

Yesterday I deleted the files but there are more than 3,000 again:
Képernyőkép_2020-03-27_18-05-12

I support database storage for session data! Very good idea! 👍

@Moc Moc added the type: enhancement An improvement or new feature request label Mar 28, 2020
@Deltik Deltik added the status: pending This issue is being worked on or is in the backlog to be fixed. label Mar 31, 2020
@lonalore
Copy link
Member Author

Session garbage collector works great. Thank you!

@Deltik Deltik added topic: documentation and removed status: pending This issue is being worked on or is in the backlog to be fixed. type: enhancement An improvement or new feature request labels Mar 31, 2020
@Deltik
Copy link
Member

Deltik commented Mar 31, 2020

@Moc: Let's categorize this as room for improvement in documentation. Users need to know that session.gc_divisor in php.ini needs to be 1 or higher and that the e107 session lifetime cannot be more than session.gc_maxlifetime.

@Deltik Deltik removed their assignment Mar 31, 2020
@Moc
Copy link
Member

Moc commented Mar 31, 2020

Yeah I added the enhancement label because I thought we'd link it to to the database storage for sessions. I'm closing this issue as with all documentation issues.

They are added to the project that keeps track of the documentation backlog (yet to start but well, at least we have it organized).

@Moc Moc closed this as completed Mar 31, 2020
@CaMer0n
Copy link
Member

CaMer0n commented Apr 13, 2020

Yes, and the database storage should be optional also.
@Deltik @Moc For 2.3.0 I suggest we tweak the session handler as it is now, perhaps with some preferences, so that the above scenario can be avoided. Or, at the very least, check the PHP.ini values and provide alerts (on the PHPInfo page of admin for example)

@lonalore
Copy link
Member Author

Btw, e.g Drupal enables garbage collection using ini_set().
Drupal 7 solution.
Drupal 8 solution is the same, but it uses yml configuration file to store these settings.

I think a possible solution might be to add these settings to the session handler, e.g to the setDefaultSystemConfig() method.

@Moc Moc reopened this Apr 18, 2020
@Moc Moc added the type: enhancement An improvement or new feature request label Apr 18, 2020
@Deltik
Copy link
Member

Deltik commented Apr 18, 2020

@CaMer0n and @lonalore: How do you like this?: https://github.com/e107inc/e107/pull/4132/files?w=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: documentation type: enhancement An improvement or new feature request type: question An ask about behavior that is not found documented anywhere
Projects
Status: Backlog
Development

No branches or pull requests

4 participants