Cache files are not cleared

Hello,

Our OnlyOffice server is running version 8.3.1-25 on debian 12

We have issues with cache files clearing, some older than 1 day are not cleared automatically. The issue seems similar to this post (we are not running OnlyOffice on Docker): Cache files aren't cleared

The default.json file seems to be configured correctly, and the database also appears to be fine.

We had to manually clear the cache files about a week and a half ago.

I attached today screenshots of folder “data” and “forgotten” folder sizes in /var/lib/onlyoffice/documentserver/App_Data/cache/files, as well as screenshots for date columns of “doc_changes” and “task_result” DB tables.

The files in the “data” folder seem fine (date < 1 day), it’s mainly the files in the “forgotten” folder that seem unusual.

Can you assist us?

Thank you!

screenshot1
screenshot2
screenshot3


Hello @technique

Firstly, let me elaborate on two main values for the cache check:

  • expire.files - defines the time of life for the folders in App_Data;
  • expire.filesCron - defines the time for check starting (every hour by default).

Basically, every hour Document Server performs cron check for the files in cache that are older than 24 hours, if such found, Document Server deletes them. However, there are certain cases where such rule does not apply, I’ve described it here:

As for the forgotten folder: in this folder Document Server stores files that were not saved back to the storage due to an error. For instance, when leaving a document, Document Server waits few seconds and then stores the file back to the storage, but if for some reason storage does not respond with "error: 0", in this case Document Server stores the file in forgotten.
Basically, these files are there until recovered or removed manually. To recover them, you need to access the file with the same key as it had in the moment of saving failure. You can try tracing possible reasons why these files are in forgotten by the names of directories inside, as they represent document.key, in logs of Document Server. That might help in finding out what happened to the file and why it is in forgotten.

Also, enabling debug level logging might help getting more information about cron jobs and results. To enable it you must edit production.json config in /etc/onlyoffice/documentserver/log4js/ diretory by changing "level": "WARN" to "level": "DEBUG" and restarting Document Server services with systemctl restart ds-*.

Hello,

Thank you for your reply.

You are right, we will have to investigate the reasons for the increasing size of the ‘forgotten’ folder. It’s mainly the content of this folder that is growing “endlessly”, reaching a large volume after a while. The content of ‘data’ folder seem fine, as the files are not older than 24h.

According to your explanations, there is no automatic way of emptying the ‘forgotten’ folder ? The only way is to perform a manual delete ?

If we consider that the content older than X days/weeks is ‘safe to delete’, can you confirm that it would not be a problem to run a custom cron to delete these files ?

Thank you very much.

As I mentioned, this folder stores all failed to save files, meaning that there could be a problem with saving after all and you may lose some modifications in the process, so this directory is not affected by the cron job for cache clearing. I’d not recommend clearing it on the time basis without making sure that reasons why files got stuck there are ruled out. Of course it is up to you.

Thank you for your reply.

1 Like