Problem/Motivation

I've just run into a ton of "Repeated rendering detected when rendering entity file: 263, using the field_image field. Aborting rendering." errors in my log when search api was indexing nodes.
The thing is that file 263 is rendered multiple times but on different entities.

Proposed resolution

The setting file_entity_protect_repeated_render already mentions:

but it can also be triggered when the same image is rendered more than 20 times, e.g. in an long content list or data feed.

I'd say that we should take the entity id, of the entity the file field is attached to, into account when checking for repeated renders.
If the same file is rendered multiple times but on different entities this shouldn't count as "repeated" render as the context of the rendering is different.
This would exactly mitigate the above mentioned data feed scenario.
We also could make this configurable if there are site effects to be expected.

Remaining tasks

Reviews needed.
Figure out if there's a case where recursion hit's with different entity ids.

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

das-peter created an issue. See original summary.

gustavowal’s picture

+1 for the patch, at the moment of writing it seemed to resolved the issue of an image being rendered multiple times on different entities.

joseph.olstad’s picture

Ok I think this should go into a release very soon.

joseph.olstad’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.