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

Issue when no reference fields in nodes #181

Open
vengador opened this issue Oct 29, 2021 · 1 comment
Open

Issue when no reference fields in nodes #181

vengador opened this issue Oct 29, 2021 · 1 comment

Comments

@vengador
Copy link
Contributor

Hi team,

Working on EMA UPD project I have detected an issue with oe_media, let me try to explain our case. We have a D8 with more than 180K nodes but there is no nodes with reference fields pointing to media items. Our media items are inserted using paragraphs.

If you got to oe_media.module and review code for oe_media_media_access function, you will see that in line 60 function tries to load all reference fields pointing to media entities. If there is no fields, in line 70 you would build a query where you would load all nids in our database and later (in line 80 you would try to load all those nodes. In our case, loading all nodes will cause an out of memory error.

I have fixed this issue with an extra check of 3 lines of code that I inserted just before we build query to select nodes:

if (empty($field_referenced_to_media)) {
return AccessResult::neutral()->addCacheableDependency($cache);
}

I hope this can be helpful for you. Please, let me know if you need some help or more info about this.

@LedzZm
Copy link
Member

LedzZm commented Dec 5, 2022

We still have this in 1.20

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

No branches or pull requests

2 participants