Problem/Motivation
If you have a managed file that is referenced by 200k entities then file_get_file_references() will cause PHP out of memory errors. It uses an unlimited entity field query and unlimited queries are bad.
Steps to reproduce
Create a managed file and reference it from 200k nodes.
Then invoke hook_file_download() for example from entity_metadata_file_access().
You get a PHP memory error.
Proposed resolution
Limit the query to just 1 result. This is not ideal and could cause problems, but in our use case a file is always used in the same field type. That has no access implications for us.
Remaining tasks
Review patch, come up with a better idea?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | drupal-file_get_file_references-3207669-2.patch | 944 bytes | klausi |
Issue fork drupal-3207669
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
klausiPatch.
Comment #5
avpaderno