Kovah / LinkAce

LinkAce is a self-hosted archive to collect links of your favorite websites.
https://www.linkace.org
GNU General Public License v3.0
2.58k stars 160 forks source link

Thousands of files on storage/framework/sessions #798

Closed macram closed 2 weeks ago

macram commented 4 months ago

Bug Description

I just got an alert from my hosting provider alerting me of an excesive inode usage. I run a command to check the directories with more files and I discovered that the directory storage/framework/sessions from my LinkAce instance was storing more than 32k files. I deleted that and new files were being created right away.

How to reproduce

Expected behavior

Logs

No response

Screenshots

No response

LinkAce version

v1.14.1

Setup Method

PHP

Operating System

Linux (Ubuntu, CentOS,...)

Client details

No response

Kovah commented 4 months ago

Do you have a lot of traffic on your LinkAce instance, maybe also from bots or crawlers? Or automated tools using the API? The only reason why LinkAce might create thousands of files for sessions is because there are a lot of sessions. But 32k sounds quite high.

Please post additional infos about your hosting environment, otherwise nobody will be able to help.

macram commented 4 months ago

I have a widget on my public blog which fetches the public RSS, but otherwise it shouldn’t have much traffic. I’ll check logs tomorrow for other kind of crawlers.

Today, right after deleting all the files, I observed how they qere being created, a few each minute.

Each anonymous visitor opens a session (and creates a file)?

Kovah commented 4 months ago

That sounds like a explanation.

To give a little context: LinkAce uses those sessions files to store information about the visitor instead of using the visitor browser cookies. Each different visitor gets his own file so that nothing gets mixed up.

Do you have by chance access to Redis or Memcache at your hosting? You can use both for storing sessions instead of using files.

macram commented 1 month ago

Hi, sorry. I'm afraid I don't have access to Redis nor Memcache.

As a potential workaround I set up a cronjob to delete each day the files from this folder, although I feel this is not optimal at all.

Kovah commented 2 weeks ago

I guess that there's nothing else we can do about this. There's no other way to store session other than using the file system or an application like Redis or Memcache.