1. REGISTRATION REQUIREMENTS:

    Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Error - memory allocation failed while rebuilding thumbnails

Discussion in 'AMS Support' started by Maxxamillion, Aug 28, 2017.

  1. Maxxamillion

    Maxxamillion New Member AMS

    May i ask what this means when i try to rebuild the thumbnails

    memory allocation failed `/home/thegamer/public_html/internal_data/temp/Ams_5Hdb2L' @ error/gif.c/WriteGIFImage/1623

    1. Imagick->writeimage() in NFLJ/AMS/Helper/Image.php at line 293
    2. NFLJ_AMS_Helper_Image->resize() in NFLJ/AMS/Deferred/Thumbnail.php at line 72
    3. NFLJ_AMS_Deferred_Thumbnail->execute() in XenForo/Model/Deferred.php at line 295
    4. XenForo_Model_Deferred->runDeferred() in XenForo/Model/Deferred.php at line 429
    5. XenForo_Model_Deferred->_runInternal() in XenForo/Model/Deferred.php at line 374
    6. XenForo_Model_Deferred->run() in XenForo/ControllerAdmin/Tools.php at line 159
    7. XenForo_ControllerAdmin_Tools->actionRunDeferred() in XenForo/FrontController.php at line 351
    8. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
    9. XenForo_FrontController->run() in /home/xxxx/public_html/admin.php at line 13
     
  2. Bob

    Bob Developer Staff Member

    It means your server ran out of memory while Imagick was attempting to write a GIF (which is probably a HUGE file that your server can't process). Your server might not be beafy enough to create animated thumbs from very large LARGE files.

    Maybe try and reduce the amount of items being processed at once. Default is 10, maybe cut that in half and see if that helps (I doubt it will, but its worth a shot to at least try it).

    Selection_091.png

    AMS does have user group permissions that you can set the max upload size for images which prevents things like this from happening.

    Selection_088.png


    There is also an AMS option that you need to set based on your SERVER limitation (upload_max_filesize in php.ini) that controls the MAX when you set "iunlimited" for the max file size on permissions.

    Selection_089.png
     
  3. Bob

    Bob Developer Staff Member

    I've seen some similar posts on xenforo.com (for XFMG) and "memory allocation failed".

    example (you might want to read this thread): MG 1.1 - Error when rebuilding XMG Thumbnails

    As Chris pointed out in that thread, the "Create animated thumbnails" does not perform well, so maybe try unchecking that is well.

    Selection_092.png
     
  4. Maxxamillion

    Maxxamillion New Member AMS

    i don't have any animated thumbnails in the article system, i tried the half of 10 but still same issue, not sure what else to do to help it run the rebuild
     
  5. Maxxamillion

    Maxxamillion New Member AMS

    ignore me i fixed it, i has the image dimensions at 3000x3000 i changed that and works fine
     
    Bob likes this.
  6. Bob

    Bob Developer Staff Member

    out of curiousity, how large (file size) is that GIF image? (if you are not sure which one it is, no biggy).
     
  7. Maxxamillion

    Maxxamillion New Member AMS

    not a clue, i don't know of any gif images that are used, also it does the rebuild now but gives me a 503 error page oh and now is giving me the same error code as i posted previously :(
     
  8. Maxxamillion

    Maxxamillion New Member AMS

    also i looked in my ftp and cant find the AMS_HLV0oI file??

    memory allocation failed `/home/thegamer/public_html/internal_data/temp/Ams_HLV0oI' @ error/gif.c/WriteGIFImage/1623
     
  9. Bob

    Bob Developer Staff Member

    the HLV0oI is the name of the IMAGE file (as it was named on the device that uploaded the file). Ams_ is appended to it during the create process.

    /internal_data/temp/ directory is used for storing the TEMP file that is being created. As soon as its created, its moved into the appropriate thumbnail directory.

    The issue is Imagick running out of MEMORY which your server controls. You are going to have to have your Sys Admin up the memory allocation on your server.
     
  10. Maxxamillion

    Maxxamillion New Member AMS

    I currently have 512mb
     
  11. MattW

    MattW Server Admin AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    Bob, this is on my server. There is 512MB allocated to PHP already.
     
  12. Bob

    Bob Developer Staff Member

    The IMAGE that is causing this error has a .gif extension (which means its a GIF). There are functions that check the extension type which is used to determine which function to use to create and save the thumbnail. In this case, the file (the uploaded full size image) is a .gif and therefor it uses the below function to process the thumbnail

    The $imageSaveFunc type is set to "ImageGIF" since the full size image file is a .gif. So this IF statement comes into play because the file is a GIF and you have ImageMagick installed and its not import mode.

    Here is the function in play.

    PHP:
            if ($imageSaveFunc == 'ImageGIF' && $this->_imageMagick && !$this->importMode)
            {
                
    $image = new Imagick($this->_image);
                
    $image $image->coalesceImages();

                foreach (
    $image AS $frame)
                {
                    
    $frame->cropImage($max_width$max_height$srcX$srcY);
                    
    $frame->thumbnailImage($newImage_width$newImage_height);
                    
    $frame->setImagePage($frame->getImageWidth(), $frame->getImageHeight(), 00);
                }

                if (
    $options->amsAnimatedThumbnails)
                {
                    @
    set_time_limit(120);

                    try
                    {
                        
    $image->writeImages($this->tmpFiletrue);
                    }
                    catch (
    Exception $e)
                    {
                        
    $image->writeImage($this->tmpFile);
                    }
                }
                else
                {
                    
    $image->writeImage($this->tmpFile);
                }

                
    $this->_setNewMainImage($this->tmpFile);

                
    $image->clear();
                
    $image->destroy();

                return 
    true;
            }
    This routine checks to see if you have the "Create animated thumbnails" checked (which I can tell you don't because its failing on line 293 which the ELSE part of this IF statement.

    PHP:
                if ($options->amsAnimatedThumbnails)
                {
                    @
    set_time_limit(120);

                    try
                    {
                        
    $image->writeImages($this->tmpFiletrue);
                    }
                    catch (
    Exception $e)
                    {
                        
    $image->writeImage($this->tmpFile);
                    }
                }
                else
                {
                    
    $image->writeImage($this->tmpFile);
                }
    That SHOULD be more than enough, but obviously isn't because there is a memory allocation error.

    Can you BUMP it up to see if it will at least allocate engough for ImageMagik to process this GIF file.
     
  13. Maxxamillion

    Maxxamillion New Member AMS

    I've looked through all attachments and ams images and no file has a gif extension so i've no idea
     
  14. Maxxamillion

    Maxxamillion New Member AMS

    let me know @Bob of anyway to fix this when you know a way please
     
  15. Maxxamillion

    Maxxamillion New Member AMS

    this has also prevented me from rebuilding any caches as when i click rebuild site indexs i get this error now as well, i even turned the addon off and still now get this error :S
     
  16. Bob

    Bob Developer Staff Member

    Once you start a deferred process, that process will remain in the deferred table and will be envoked any time another deferred process is initiated (and they run in order, so if one is stuck, it will need to be manually cleared). Have MATT W clear the Deferred Table for you. Do not attempt to run the AMS Thumbnail rebuilds until Matt asks you to give it another try.
     
  17. MattW

    MattW Server Admin AMS Premium CAS Premium RMS Premium SC Premium UBS Premium

    I've increased the memory allocation to 1gb

    EDIT. it's still erroring. I'm not going to allocate more than 1gb of memory to rebuild a gif on shared hosting.
     
  18. Maxxamillion

    Maxxamillion New Member AMS

    ok, ill wait
     
  19. Bob

    Bob Developer Staff Member

    Matt is on Vacation, so any Sys Admin type tasks are going to need to wait until he is back on the clock.

    You also need some Database related tasks performed, one of which would be to truncate the deferred table so that the stuck rebuild process is cleared which will allow others to be processed. If you can get me phpMyAdmin access, I can do that for you. I can also run a query against the xf_attachment and xf_attachment_data tables to fetch all GIF attachments for AMS. This will give me a list of Article Id's that have any GIF attachments (which you can then edit those articles and remove any large GIF attachments).
     
    Maxxamillion likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.