Skip to content

Magento 2.4.1 Media Gallery....not ready for prime time. Fails when you have large amounts of data (images) #30596

Open
@perfpcs

Description

@perfpcs

Preconditions (*)

The new media gallery introduced in Magento 2.4.1 certainly was not vetted using a large robust shop. Maybe it was designed with 100-200 products like the using Magento sample data but I can tell you from my experience trying to use this, it does NOT work when you have a large amount images. Since we use compression software to have images ready for desktop, table, phone and WEBP use. We have generated over a half a million images for our shop. What happens is that the images will load but the directory tree fails to generate due to sessions being destroyed and memory exhaustion. Even setting php.ini to basically unlimited use of ram and setting our instance to 192 GB physical ram, the media gallery still fails to load the directory tree. This is very disappointing! What I don't understand either is why would the media galley be set with /media as the storage root? This is the main problem as 95% of the images in the media gallery are product images. Most shops don't use product images to create banners or make CMS blocks or pages. The correct root for media gallery in my opinion should have been the /wysiwyg directory. That is what is used when dealing with media and the CMS block and pages creation. If this was set as root then these issues with session destruction and memory failures would never happen. Or, the media gallery should exempt the catalog/product images like it is in the old media gallery. If you go to those catalog/product folders you will see there are no images. That is another correct way this gallery should have been setup, in my humble opinion.

How to produce error (*)

  1. Install M 2.4.1
  2. Move your media content from your current or old website that has 500,000 or more images
  3. Go to content/media galley
  4. Media gallery will open with images but directory tree is missing. You can't find folders or see any folders or even see new ones if you make any. Note the folders are created but because the tree is not there, you cannot see the folders. Also it is random whether the search, sort or other fields show up. Sometimes they do and sometimes they dont.

Steps to reproduce (*)

  1. Install M 2.4.1
  2. Move your media content from your current or old website that has 500,000 or more images
  3. Go to content/media galley
  4. Open Media gallery

Expected result (*)

  1. I expect that the directory tree, search, sort and full media gallery opens, not a crippled version of the media gallery that does not even work.

see various images. It should look like this:

image

Actual result (*)

  1. Many errors in php log:

[19-Oct-2020 04:26:51 UTC] PHP Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 8192 bytes) in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Filesystem/Driver/File.php on line 962
[19-Oct-2020 04:26:51 UTC] PHP Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 135168 bytes) in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Session/SessionManager.php on line 151
[19-Oct-2020 04:26:51 UTC] PHP Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 65536 bytes) in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/colinmollenhour/php-redis-session-abstract/src/Cm/RedisSession/Handler.php on line 793
[19-Oct-2020 04:26:51 UTC] PHP Fatal error: Uncaught RuntimeException: Unknown: Cannot call session save handler in a recursive manner in [no active file]:0[19-Oct-2020 08:29:18 UTC] PHP Warning: DOMXPath::query(): Invalid expression in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/pelago/emogrifier/src/Emogrifier.php on line 494
[19-Oct-2020 08:29:18 UTC] PHP Warning: DOMXPath::query(): Invalid expression in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/pelago/emogrifier/src/Emogrifier.php on line 494
[19-Oct-2020 08:29:18 UTC] PHP Warning: Invalid argument supplied for foreach() in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/pelago/emogrifier/src/Emogrifier.php on line 503
[19-Oct-2020 09:06:41 UTC] PHP Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 8192 bytes) in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Filesystem/Driver/File.php on line 962
[19-Oct-2020 09:06:41 UTC] PHP Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 40960 bytes) in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Session/SessionManager.php on line 151
[19-Oct-2020 09:06:41 UTC] PHP Fatal error: Allowed memory size of 792723456 bytes exhausted (tried to allocate 65536 bytes) in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/colinmollenhour/php-redis-session-abstract/src/Cm/RedisSession/Handler.php on line 793
[19-Oct-2020 09:06:41 UTC] PHP Fatal error: Uncaught RuntimeException: Unknown: Cannot call session save handler in a recursive manner in [no active file]:0[19-Oct-2020 09:54:47 UTC] PHP Fatal error: Uncaught RuntimeException: ObjectManager isn't initialized in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/App/ObjectManager.php:36
Stack trace:
#0 /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Filesystem/Directory/Read.php(78): Magento\Framework\App\ObjectManager::getInstance()
#1 /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Filesystem/Directory/Read.php(212): Magento\Framework\Filesystem\Directory\Read->validatePath()
#2 /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Code/GeneratedFiles.php(123): Magento\Framework\Filesystem\Directory\Read->isExist()
#3 /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/Code/GeneratedFiles.php(98): Magento\Framework\Code\GeneratedFiles->isCleanGeneratedFilesAllowed()
#4 /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/App/ObjectManagerFactory.php(114): Magento\Framework\Code\GeneratedFiles->cleanGeneratedFiles()
#5 /home/ in /home/cloudpanel/htdocs/www.performance-pcs.com/vendor/magento/framework/App/ObjectManager.php on line 36

  1. Screenshots
    image
    image

Things we tried and results:

  1. Our Host of AWS Cloud server adjusted these settings in this order:
    a. From the error shown you have reached the limit of 768M that was set on the php config file.
    We have increased it and set to memory_limit = 1024M
    b. The php-fpm of cli had memory_limit = 4048M. We have set this to unilimited
    c. So we have increased the memory limit to :8092M on file ".user.ini" on Magento root & inside pub/ location.
    mgt@performance-pcs:/home/cloudpanel/htdocs/www.performance-pcs.com/pub$ cat .user.ini
    memory_limit = 8092M
  2. How we fixed: Well we didn't fix actually but we proved to ourselves that it was the number of images that caused the problem. So we moved all our images out of media except for about 200 or so. And vola! The media gallery opened fine with the proper tree structure, search and sort fields and all functions worked.

image

So now what?? We need to access all our NON-PRODUCT IMAGES!. I can turn back on old media gallery and it does work but I would like to use the new one with the Adobe image features, that is handy!

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [X ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Additional info from Engcom

To reproduce the issue

  1. Execute this file to generate empty txt files in media folder https://gist.github.com/Nazar65/61c756ce76afa8c6718bf670794d548c execute in CMD bash glob.sh
  2. Set memory_limit in php to 100MB
  3. Open Media Galley

Actual Result: Media gallery directory tree component renders directory tree component

Metadata

Metadata

Labels

Component: MediaGalleryIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: PR CreatedIndicates that Pull Request has been created to fix issueProgress: ready for groomingReported on 2.4.1Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S1Affects critical data or functionality and forces users to employ a workaround.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions