Skip to content

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

@drzraf

Description

@drzraf

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions