Jump to content
snck

Max execution time exceeded in Pageimage.php for specific pages

Recommended Posts

Hi there,

I am having a strange problem. I have a bunch of sites that have similar content (text, images, map markers), but I am not able to edit two specific pages in the backend. I always get the following error (or 503 service unavailable):

Maximum execution time of 30 seconds exceeded (Zeile 520 in [...]/wire/core/Pageimage.php)

Line 520 in Pageimage.php:

$imagick->readImage($filename);

All of the images used on all of the pages are SVG drawings and I have no clue why there are no problems with the majority of pages but just two of them. Maybe one of you guys has experienced a similar problem with ImageMagick and SVGs?

I have debug mode enabled, but I only get these errors and nothing more specific. Is there any smart way to find the source of the error?

In the assets folder for all of the pages there are only SVGs so I expect no conversion to be done. If no conversion is happening, why would the script run into the max execution time? 

I appreciate your thoughts on this.

Cheers,
Flo

Share this post


Link to post
Share on other sites
On 4/24/2020 at 10:24 AM, kongondo said:

@snck

Did you get this resolved?

I further investigated the issue by reviewing all of the SVG files used on the pages that have thrown errors and comparing them to files from pages that were editable without problems. I realised that the guys who generated the files (architecture students) used different software in their process (Adobe Illustrator, Vectorworks etc.) which led to really complex files. I ran some of them through an online SVG minification tool which helped to resolve the issue in some cases and instructed the students to develop a kind of maximum complexity guideline for their files.

To make the backend usable again and offer them a chance to exchange their "bad" files, it raised the max_execution_time temporarily in the .htaccess:

php_value max_execution_time 120

 

  • Like 1

Share this post


Link to post
Share on other sites

@snck,

Thanks for reporting back.

12 minutes ago, snck said:

used different software in their process (Adobe Illustrator, Vectorworks etc.) which led to really complex files.

I don't know much about SVGs, excuse my ignorance please. Was the issue the complexity of the files or the size of the files? I am guessing though that complex files would probably also be large in size. 

Thanks.

Share this post


Link to post
Share on other sites
18 minutes ago, kongondo said:

@snck,

Thanks for reporting back.

I don't know much about SVGs, excuse my ignorance please. Was the issue the complexity of the files or the size of the files? I am guessing though that complex files would probably also be large in size. 

Thanks.

Size alone should not be a problem (considering that I have used a lot of much bigger JPEG images with IMagick). In some cases the SVGs consisted of many 1000 paths and a lot of class definitions for their styling. I do not know the how efficient the rasterizing in IMagick works, but I guess it was the bootleneck in this specific case.

  • Like 2

Share this post


Link to post
Share on other sites

In reality, that getImageInfoSVG() method should probably try to get the dimensions from the viewbox attribute in the SVG (if actual width and height attributes are not available), before it resorts to using imagick to get them. That would remove the need to rasterize just to get the dimensions.

Share this post


Link to post
Share on other sites

I have personally found errors related to imagick and pageimage.php to be misleading as the failure can happen at the server / imagick module level and can be due to issues with multi-threading. Are you in a multi-threaded (ie two or more cpu cores) environment and are the timeouts happening much faster than 30 seconds?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      Hello all,
      sharing my new module FieldtypeImageReference. It provides a configurable input field for choosing any type of image from selectable sources. Sources can be: 
      a predefined folder in site/templates/ and/or a  page (and optionally its children) and/or the page being edited and/or any page on the site CAUTION: this module is under development and not quite yet in a production-ready state. So please test it carefully.
      UPDATE: the new version v2.0.0 introduces a breaking change due to renaming the module. If you have an older version already installed, you need to uninstall it and install the latest master version.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImageReference
      Install from URL: https://github.com/gebeer/FieldtypeImageReference/archive/master.zip
      Read on for features and use cases.
      Features
      Images can be loaded from a folder inside site/templates/ or site/assets Images in that folder can be uploaded and deleted from within the inputfield Images can be loaded from other pages defined in the field settings Images can be organized into categories. Child pages of the main 'image source page' serve as categories mages can be loaded from any page on the site From the API side, images can be manipulated like native ProcessWire images (resizing, cropping etc.), even the images from a folder Image thumbnails are loaded into inputfield by ajax on demand Source images on other pages can be edited from within this field. Markup of SVG images can be rendered inline with `echo $image->svgcontent` Image names are fully searchable through the API $pages->find('fieldname.filename=xyz.png'); $pages->find('fieldname.filename%=xy.png'); Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message with links to help you edit those pages and remove references there before you can finally delete the image. This field type can be used with marcrura's Settings Factory module to store images on settings pages, which was not possible with other image field types When to use ?
      If you want to let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site (e.g. icons, but not limited to that).
      Other than the native ProcessWire images field, the images here are not stored per page. Only references to images that live on other pages or inside a folder are stored. This has several advantages:
      one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Installation and setup instructions can be found on github.
      Here's how the input field looks like in the page editor:

      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Install from URL: https://github.com/gebeer/FieldtypeImageReference/archive/master.zip
      Eventually this will go in the module directory, too. But it needs some more testing before I submit it. So I'd really appreciate your assistance.
      Thanks to all who contributed their feedback and suggestions which made this module what it is now.
       
    • By rst
      I am having problems uploading svg images in the the latest pw 3.0.98. It shows the preview and has the spinner on top of it, and just gets stuck on that.
      Worked fine in the previous version of PW
    • By Andreas Augustin
      Hey!
      We use Processwire in for Blue World Content Section and did some fancy SVG Primitive lazyloading for our images.
      How do you like it: https://www.blue-tomato.com/blue-world/
      We also wrote an article about how we did it:
      https://dev.to/btdev/hey-user-you-already-see-me11---svg-based-image-lazyloading-as-a-matter-of-enjoyable-ux-1de9
    • By sirhc
      Hi all,
      Im trying to install this core module and got the error of not having the ImageMagick library installed.
      But if im checking for the version of my ImageMagick installed on my server via SSH im getting this response;
      identify -version
      Version: ImageMagick 6.9.4-9 Q16 i386 2016-06-21 http://www.imagemagick.org
      Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
      License: http://www.imagemagick.org/script/license.php
      Features: Cipher DPC 
      Delegates (built-in): bzlib freetype gslib jng jpeg png ps tiff xml zlib
      Does this even mean the library is installed? And if yes, why cant i install my module?
      Pleaassee help me
      Greetz.
    • By Cody Connor
      I am currently working on a website in process wire.  I created an image field and added svg as a valid file extension and could upload a png image and a jpg image but when I try to upload a svg image it is stuck loading at 100%.  I figured out that the image field does not take the extension svg even if I add it as an extension. and I was wondering if their is any way to upload a svg image to an image field in processwire?
      I am working with processwire version 3.0.61

×
×
  • Create New...