Closed (fixed)
Project:
Entity Reference Revisions
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Sep 2019 at 12:45 UTC
Updated:
17 Mar 2021 at 20:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
super_romeo commentedComment #3
anita_novicell commentedI have run in to the same problem.
In my case, I am using layout builder. I go to my content display mode and choose "manage layout". The layout builder will populate the template with sample values. If my content type has a field of the type entity reference revisions, the generateSampleValues() method will be used to do this.
The generateSampleValues() method invokes the getReferenceableEntities() method in Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection to check if there are any referenceable entities in the database. However, it is invoked without a limit parameter, so it will attempt to load ALL referenceable entities in the database. If you have a large site with thousands of entities, the process will time out.
The patch provided in comment #2 adds a limit to the method, in order to only load 50 entities. However, the generateSampleValues() method doesn't use existing entities but creates its own dummy entity, so there is actually no need at all for this check nor for loading any existing entities. It should be removed completely, unless the method is changed to actually use existing entities for sample values.
This patch will do that: https://www.drupal.org/files/issues/2019-08-18/2568187-errgen-29.patch
I found it in this issue: https://www.drupal.org/project/entity_reference_revisions/issues/2568187
The foreach is not unlimited, just very large, and it will happen with all entity types, not just paragraphs, so the issue title is misleading and the issue has no description. It took me a long time to even find this issue, and I was just about to create a duplicate.
Comment #4
anita_novicell commentedI have updated the title and description of the issue
Comment #5
azinck commentedCan confirm this is a problem, and can confirm #4 fixes it for us. Thanks @anita_novicell!
Comment #6
berdirThanks, committed.