I'm posting this purely as a PSA for others out there who, like me, are seeing performance and memory usage problems after enabling this module.

In my case, I had a node using 900MB of memory with this module enabled vs 54MB with it disabled.

This was not caused by a bug in the module.

Instead, it was caused by the fact that I had a bug in an import script that had caused hundreds of duplicates of each file entity to be created, with identical URIs. So, specifically, each of the 40 images I was displaying on this page resulted in the module loading 1800 file entities due to this line of code:

$files = \Drupal::entityTypeManager()
    ->getStorage('file')
    ->loadByProperties(['uri' => $variables['uri']]);

So, if you're like me and you have many files with the same URI...find what's causing that and fix it and remove your duplicates!

/End of PSA.

PS: I'm honestly not at all convinced this is a good place for me to post this. Maybe it's worth calling out in a readme? Or maybe I'm the only crazy person who's run into this. Do with it as you see fit. Thanks for the module!

Comments

azinck created an issue. See original summary.

azinck’s picture

Issue summary: View changes
grimreaper’s picture

Status: Active » Fixed

Hello,

Thanks a lot for your feedback!

I think that the case of multiple file entities with the same URI should never happen so I don't think (and hope that) there will be similar case.

Marking as fixed if people search for closed issues they will be able to find it.

Status: Fixed » Closed (fixed)

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

azinck’s picture

Thanks @Grimreaper. That's entirely appropriate. I'm going to just leave a link to the bug in the migrate_file module that led to me having duplicate files with the same URI, in case someone finds themselves doing the same detective work I had to do: #3203781: Migrate in update mode not updating existing file but creating new file entry