Open webcodecs opened 1 week ago
Can you try moving the storage of the nocache
tag into a database to see if it helps? https://statamic.dev/tags/nocache#database
@duncanmcclean after changing the nocache driver to database, their is only one entry as expected in the database table.
If its possible we want to avoid using a database
I see the issue, thanks. I'm curious why you are using nocache
tags without static caching though.
It is noticed in the local development environment where I have disabled the static cache
Okay so it's not something that affects you in production. 👌
Because we are in early stage of a relaunch we deactivated the static caching on the staging server too. But yes when we are live, the caching strategy will be set
Bug description
We are currently encountering an issue on one of our sites that ultimately results in a php memory leak error. After some investigation we found that the cause for this problem is a cache file under storage/statamic/static-urls-cache. The file in question seems to be responsible for storing the String regions for the Nocache tag, which we use inside our nav section to handle some authentication-based renderings.
It seems that loading the page is triggering the write() and restore() methods of src/StaticCaching/NoCache/Session.php. The restore() method is performing a merge of the String region collection items, which results in the file mentioned above doubling in size after each request. After ˜20 reloads of our site we run into the memory error mentioned above. We then need to remove the file in question or perform a full cache flush via command line or the CP.
As far es we know this issue is only present when using
STATAMIC_STATIC_CACHING_STRATEGY=null
. As I understand it, the files should not even be written if the caching strategy is null. The problem can be solved by appending->unique()->values()
to the merge call in src/StaticCaching/NoCache/Session.php:126 , but we don't know if this is a viable solution to the problem, as we have limited knowledge about the ins and outs. I can imagine that the merge was based on the assumption that existing regions would be overwritten. However, this only works with an associative array. We have a list at this point.How to reproduce
Fore each refresh one file within
storage/statamic/static-urls-cache
will get bigger and biggerLogs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response