Undocumented /mnt/data/sessions directory filling up with files

I’m running Owncloud 10.13.3 on my home Kubernetes cluster where I have a persistent volume mounted into /mnt/data on which all the config, apps, and data are stored. All well and good.

However in the process of setting up automated backups of data I found the sessions directory contains about 80,000 files all with a single line of content looking something like:

encrypted_session_data|s:325:"v2|...............";root@

I’ve excluded this from backups for now, but I’m concerned because it looks like the files here are not being cleaned up, and at some point I’m going to run out of inodes on the filesystem and things may grind to a halt.

Does anyone know whether there is a way to keep this directory trimmed?

Currently my hypothesis is that the sessions from this directory are the result of the various background connections from the macos and android apps I have running, but I don’t see any documentation to that effect. What gives?


Expected behaviour

The /mnt/data/sessions directory does not grow endlessly.

Actual behaviour

The /mnt/data/sessions directory is full of 80k files and growing at about 18 every minute.

Server configuration

Operating system: Linux container

Web server: Apache

Database: Mariadb

PHP version: 7.4.3

ownCloud version: 10.13.3

Updated from an older ownCloud or fresh install: Fresh

Where did you install ownCloud from: docker.io/owncloud/server:10.13.3

Signing status (ownCloud 9.0 and above):

No errors have been found.

The content of config/config.php:

Uploaded at gist.github.com/astromechza/49c2981a8816fd3ad8fd04c7dbe54527

Are you using external storage, if yes which one: No

Are you using encryption: No

Are you using an external user-backend, if yes which one: No

Hey,

i don’t have such a “sessions” folder in my data folder on a non-docker / kubernetes installation so i think these are not originating from ownCloud (and thus are i think also not documented because due to not being part of ownCloud).

But i think this could be the PHP session folder and from what i know there is a phpsessionclean service which is cleaning up this folder and i think that it could be possible that this doesn’t work on the current Docker images.

I’m not sure if the ownCloud community can help much on such Docker image topics so i think it could be the best to raise an issue for the ownCloud people over at Issues · owncloud-docker/php · GitHub

2 Likes

Good advice! I see that the PHP/Apache install in the container has a crontab file for exactly this

$ tail /etc/cron.d/php
# Look for and purge old sessions every 30 minutes
09,39 *     * * *     root   [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi

And i confirmed that running that script does indeed clean the sessions out.

Notably the helm chart values didn’t include an option for a cleanup cron job, it only runs the normal occ system:cron and not /usr/lib/php/sessionclean. I’ve manually added a Kubernetes cronjob for this.

I’ve cut a ticket against the helm chart in Missing cronjob call for /usr/lib/php/sessionclean · Issue #66 · owncloud-docker/helm-charts · GitHub.

3 Likes

Thanks for the report. Let’s continue discussion in the GitHub issue.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.