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

Memory leak due to cache tag usage #9737

Open
bellevue7k-user opened this issue Mar 15, 2024 · 0 comments
Open

Memory leak due to cache tag usage #9737

bellevue7k-user opened this issue Mar 15, 2024 · 0 comments
Labels

Comments

@bellevue7k-user
Copy link

Bug description

Only the page with the code blog below gives this error on average once a week.

Allowed memory size of 536870912 bytes exhausted (tried to allocate 169795472 bytes) {"exception":"[object] (Symfony\Component\ErrorHandler\Error\FatalError(code: 0): Allowed memory size of 536870912 bytes exhausted (tried to allocate 169795472 bytes) at /home/web...../vendor/laravel/framework/src/Illuminate/Cache/FileStore.php:84)

Then, clearing the Application Cache and Content Stache fixes it. I think that should be here an usage error . Because it is just an team page and does not consist of very large data.

Relevant code:

<div class="l-team__cards">
      {{ collection:team sort="last_name" as="teammember" }} 
          {{ teammember }}
              {{ cache key="team_cache_{id}" }}
                  {{ partial:partials/teamcard }}
              {{ /cache }}
          {{ /teammember }}
      {{ /collection:team }}
</div>

cache clearing:

 Event::listen(function (EntrySaved $event) {
      if ($event->entry->collectionHandle() === 'team') {
          Cache::forget('team_cache_'.$event->entry->id);
      }
  });

I used cache tags in many different ways. For example, I used scope and for instead of key, but the result is still the same.

How to reproduce

The page where only the {{ cache tag }}  is used gives this error on average once a week.

Logs

Allowed memory size of 536870912 bytes exhausted (tried to allocate 169795472 bytes) {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 536870912 bytes exhausted (tried to allocate 169795472 bytes) at /home/web...../vendor/laravel/framework/src/Illuminate/Cache/FileStore.php:84)

Environment

Environment
Application Name: Wep Page Name
Laravel Version: 10.30.1
PHP Version: 8.2.16
Composer Version: 2.5.5
Environment: production
Debug Mode: OFF
URL: .........com
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: sendmail
Queue: sync
Session: file

Statamic
Addons: 2
Antlers: runtime
Stache Watcher: Disabled
Static Caching: Disabled
Version: 4.53.0 PRO

Statamic Addons
steadfastcollective/statamic-csv-exporter: 2.2.1
takepart-media/statamic-oreos: 1.3.0

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

None

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants