1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MG 1.1 Error when rebuilding XMG Thumbnails

Discussion in 'Media Gallery Support' started by sami simo, Jan 15, 2016.

  1. sami simo

    sami simo Well-Known Member

    When trying to rebuild XenForo Media Gallery Thumbnails, I get this error:

  2. Mike

    Mike XenForo Developer Staff Member

    The PECL Imagick extension/ImageMagick failed to allocate memory. This might indicate that you're out of memory or that there's a limitation on the amount of memory your process can allocate. Does it happen every time?
    sami simo likes this.
  3. Chris D

    Chris D XenForo Developer Staff Member

    I should add that this option doesn't perform particularly well:
    If you have this option enabled, disable it, and see if the process finishes successfully.
  4. sami simo

    sami simo Well-Known Member

    Yes, it happened all the time.
  5. sami simo

    sami simo Well-Known Member

    Thanks Chris, its already disabled and I have no animated pictures in my gallery.
  6. sami simo

    sami simo Well-Known Member

    I get similar error when trying to remove addons:
    Now, I cant uninstall any addon in my forum, any idea?
  7. Chris D

    Chris D XenForo Developer Staff Member

    Sorry I neglected to reply to this sooner.

    Uninstalling an add-on will add some more deferred processes to run, but first it will try to complete the existing ones and the thumbnail one hasn't finished yet, hence the error.

    In the first instance, I suggest removing the thumbnail rebuild entry from the xf_deferred table, this will allow you to continue anything else you need to do.
    (Using phpMyAdmin, go to the xf_deferred table and delete the record that has a class of "XenGallery_Deferred_Thumbnail")

    Secondly, if you go to your Admin CP <your_url>/admin.php?tools/phpinfo what is your memory_limit setting? It may be worth increasing this and restarting PHP/the webserver to see if it makes a difference.

    Incidentally, this actually could be a bug. On upload we bail out of thumbnail creation under certain conditions, we may well not be checking those conditions when rebuilding thumbnails.
    sami simo likes this.
  8. sami simo

    sami simo Well-Known Member

    Thanks Chris, the memory limit in phpinfo is : 512M.
    is this is too small? if yes, I will try to increase it, I prefer to do that rather than touching any database table.
  9. Chris D

    Chris D XenForo Developer Staff Member

    512M is actually pretty big.

    If there's enough physical memory on the server, it wouldn't hurt to increase it but only temporarily.

    If it still doesn't work, please return the memory limit back to what it was and then start a ticket from your customer area and provide FTP access. It would be interesting to ascertain which image is causing this.
  10. MattW

    MattW Well-Known Member

    Chris, I've increased the memory allocation to 1024M.
    sami simo likes this.
  11. sami simo

    sami simo Well-Known Member

    Thanks Matt for you help.
    Incresing memry limit didnt help unfortunately to remove the error.
    @Chris D I will open a ticket with the requierd information.
  12. Chris D

    Chris D XenForo Developer Staff Member

    Well, this makes very little sense, so far.

    The images it falls over on are in a certain category (link in ticket). They are all single frame gifs that are actually quite small; around 500 x 500 px. The interesting fact is that of course the images are about 18 months old and were uploaded and thumbnailed at some point in the past and they obviously didn't error out then.

    It's not uncommon for the imagick module or Image Magick itself to have bugs. The imagick module you have installed is version 3.1.2 (which is quite old, circa 2013) and the Image Magick build itself is from 2011 I think. PHP is up to date. It might be worth updating the imagick module and the Image Magick application itself to see if it makes a difference. If the images were originally uploaded on this server, something has changed since then (the code itself hasn't). Judging by the age of the imagick stuff, it may well be that the only thing that has changed is the PHP build, so my only feasible assumption so far is an incompatibility with newer PHP and older imagick stuff.

    @MattW if this is possible, please let us know how you get on.

    I managed to get the thumbnail rebuild (and the rebuild caches from your add-on install/uninstall) done by skipping the problematic images. For now, I've commented this skip out of the code (so the problem currently still exists). If upgrading imagemagick doesn't help, then you can uncomment the "continue" line from the following code in library/XenGallery/Deferred/Thumbnail.php and those image files will be skipped:
                if (in_array($item['media_id'], [2829303132333435363738]))
  13. MattW

    MattW Well-Known Member

    Imagick was installed via the built in RPM function in cPanel. If those images were added 18 months ago, that's well before they were hosted on my servers. This is a shared server, so I can't really go rebuilding stuff ad-hoc :(
  14. sami simo

    sami simo Well-Known Member

    I have deleted this category with all those images, rebuild is done succesfully.
    Thanks to @MattW and @Chris D for all your help.:)
    MattW and Chris D like this.

Share This Page