Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time limit exceeded `Operation canceled' @ fatal/cache.c/GetImagePixelCache/1868. #154

Open
drzraf opened this issue Dec 24, 2021 · 4 comments

Comments

@drzraf
Copy link

drzraf commented Dec 24, 2021

php -d max_execution_time=42 $(which wp) eval "echo ini_get('max_execution_time');"
// outputs 42

time php -d max_execution_time=42 $(which wp) media regenerate --only-missing --yes

php7.4: time limit exceeded `Operation canceled' @ fatal/cache.c/GetImagePixelCache/1868.
real	0m30,995s
user	0m27,111s
sys	0m3,571s

Sounds strange at first but this is a limit set by /etc/ImageMagick-6/policy.xml
Eg: <policy domain="resource" name="time" value="84"/> will change the image operation timeout

  • The main problem is that ImageMagick time limit applies on the whole run, not on individual image operation.
  • Still, the error message is confusing and hopefully wp-cli could do something about that.
  • Changing the time limit is possible Imagick::setResourceLimit( Imagick::RESOURCETYPE_TIME, 3*3600);

On a somehow related note: https://core.trac.wordpress.org/ticket/52569 was about the problem of PHP timeout in the middle of an ImageMagick operation.

Ref: wp-cli/wp-cli#4974
Ref: Imagick/imagick#333

@bgabler
Copy link

bgabler commented May 21, 2022

Starting to run into this quite a lot. Was there ever any fix available?

@danielbachhuber
Copy link
Member

@drzraf Any recommendations for how WP-CLI might be able to handle this better?

@drzraf
Copy link
Author

drzraf commented Jan 27, 2023

Not really. We can't even catch the failure consistently. The php-imagick side of the things would definitely needs love and priority (and somehow the WP-core part too). Then only wp-cli could be improved to handle this (maybe by anticipating/resizing the batch/time of image operations to workaround this).

NB: The timeout problem regularly leaves some of my servers with a /tmp full of imagick temporary files (which are not garbage collected), as commented in https://core.trac.wordpress.org/ticket/52569

@danielbachhuber
Copy link
Member

@drzraf Ok, thanks for the update. We can leave this leave this open to see if a solution presents itself. I'll also follow along on that core ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants