HEIC preview fails with 512 MiB Imagick limit despite policy.xml override (fixed by newer ImageMagick/libheif)
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- docker, php
- 領域
- devops, infrastructure
調査の方向性
まず、PHP Imagick の直接テストで失敗を再現し、/etc/ImageMagick-7/policy.xml を含む、公式 Nextcloud Docker イメージの ImageMagick セットアップを調査します。提供されている ImageMagick/libheif パッケージと、テストに使用された新しいバージョンを比較します。更新されたイメージが、影響を受ける HEIC ファイルについて 512 MiB エラーなしでプレビューを生成できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
TL;DR
Current included Imagick can't decode many larger heic due to bug, package update fixes bug.
Description
HEIC images fail to generate previews in the stock Nextcloud Docker image due to an Imagick memory/security limit at exactly 512 MiB. Increasing ImageMagick policy limits and Nextcloud preview limits does not resolve the issue. Upgrading the ImageMagick/libheif stack inside the container immediately fixes the problem.
Steps to reproduce
- Deploy official Nextcloud Docker image
- Upload HEIC image (modern phone photo, high resolution)
- Trigger preview generation (web UI or background jobs)
Actual behavior
Preview generation fails with:
ImagickException:` Memory allocation error:
Security limit exceeded: Allocating 599270415 bytes exceeds the security limit of 536870912 bytes
@ error/heic.c/IsHEIFSuccess/141
Expected behavior
- ImageMagick should respect configured policy.xml limits
- HEIC previews should succeed when sufficient memory limits are configured
What was tested
1. Nextcloud config
php 'preview_max_memory' => 1024,
→ No effect
2. ImageMagick policy override
/etc/ImageMagick-7/policy.xml modified:
<policy domain="resource" name="memory" value="1GiB"/>
<policy domain="resource" name="map" value="2GiB"/>
<policy domain="resource" name="disk" value="8GiB"/>
<policy domain="system" name="max-memory-request" value="1GiB"/>
→ Confirmed present inside running container
→ No effect (error still at exactly 536870912 bytes)
3. Direct PHP test (outside Nextcloud)
php -r 'try{
$im=new Imagick();
$im->readImage("/path/to/file.heic");
echo "OK\n";
}catch(Throwable $e){
echo $e->getMessage(),"\n";
}'
Result: Same 536870912-byte security limit error
→ Confirms issue is not Nextcloud-specific
4. Temporary upgrade inside container
Added newer packages (Debian sid):
apt-get update
apt-get install -y -t sid libheif1 libmagickcore-7.q16-10 libmagickwand-7.q16-10
Then reran same PHP test:
OK
→ Same HEIC file loads successfully
Conclusion
- The failure is tied to the ImageMagick/libheif version shipped in the container
- The HEIC decode path appears to ignore or be constrained by a fixed 512 MiB limit in that build
- Policy changes (
max-memory-request, etc.) do not affect this behavior - Upgrading the stack resolves the issue immediately
Environment
Nextcloud Docker image (official)
PHP imagick 3.8.1
ImageMagick 7.1.1-43 (container default)
libheif 1.19.8
Debian-based container
After manual upgrade:
- HEIC decoding works (with minor ABI warning)
Request
- Update ImageMagick/libheif packages in the base image
Notes
This is reproducible via direct PHP Imagick usage (not specific to Nextcloud)
The error is deterministic and always occurs at 512 MiB allocation threshold
Behavior changes immediately with newer ImageMagick/libheif
- 主要言語
- Shell
- スター
- 7.4k
- フォーク
- 1.9k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/docker のほかの issue
-
1. To develop bug feature: cron image
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
bug docs
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
0. Needs triage bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
Imagick architecture mismatch (x86_64 vs aarch64) on official arm64 image causes Apache segfaultsオープン0. Needs triage bug
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
nextcloud/docker の issue をすべて見る
似ている issue
-
area:install bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Netcracker/qubership-test-pipelines#307 ·
メンテナーはふだん 2 日以内に返信
-
Webcam overlay freezes during voxtype dictation while screen recording (pause_media pauses the overlay mpv)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
TYPO3BestPractices/tea#2409 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
msys2/MSYS2-packages#6825 ·
メンテナーはふだん 1 日以内に返信