Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.
This repository was archived by the owner on May 21, 2025. It is now read-only.

Imagick does not limit its memory usage, can crash php-fpm processes #67

@OscarBarrett

Description

@OscarBarrett

Description

e.g. For a container with a 768M memory limit, uploading a 6MB GIF to the Assets section will cause the php-fpm process to exhaust all available memory then be killed.

This can be limited by setting ENV MAGICK_MEMORY_LIMIT 200M in the image (or some other sane memory limit for the use case).

Would like to suggest that this gets baked in to the image.

Steps to reproduce

  1. Upload a large image to the Asset library
  2. See 502 in the network tab, logs
[16-Nov-2022 07:27:43] WARNING: [pool www] child 30 exited on signal 9 (SIGKILL) after 161.276694 seconds from start
[16-Nov-2022 07:27:43] NOTICE: [pool www] child 35 started
2022/11/16 07:27:43 [error] 19#19: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 172.24.0.1, server: _, request: "POST /index.php?p=admin/actions/assets/upload HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost", referrer: "http://localhost/admin/assets/assets"

This happens after just a few seconds.

Additional info

  • Craft version: 3.7.59
  • PHP version: 7.4
  • Database driver & version: MySQL 8
  • Plugins & versions: N/A
  • Image: craftcms/nginx:8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions