Skip to content

[5.x]: 5.6.12 Memory issues querying Category entries from large set of entries #16920

@smcguire1

Description

@smcguire1

What happened?

Description

After upgrading from 5.6.11 to 5.6.12, one page on our site ran out of memory. I upped the memory in PHP and found the load times ballooned from 3-4 seconds to over 50 seconds and used over 10 times the amount of memory. It didn't even register in the debug page until I took out one of the loops that searches all of the categories assigned to 60 entries. (Query Count down from 2559 to 2426).

The page loops through all 60 entries in a section, and inside that loop it pulls two different categories that have been assigned to each entry. It appears to be these queries to the categories (eg. entry.research.all()) that are causing the issues. Removing any of these category queries causes the page load to go back down to normal with normal memory usage.

Steps to reproduce

  1. Load the page in 5.6.11 - 3-4 seconds
  2. Upgrade to 5.6.12
  3. Load the same page - 40-50 seconds or runs out of memory

Let me know if you need examples of code or better explanations as to what we're doing.

Thank you!

Craft CMS version

Craft CMS 5.6.12

PHP version

8.3.19

Operating system and version

Debian 12.10 - Linux 6.1.0-32-amd64

Database type and version

MariaDB 10.11.11

Image driver and version

No response

Installed plugins and versions

CKEditor 4.6.0
Publisher X 5.0.0
Retour 5.0.8
SEOmatic 5.1.11

Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions