cache:warmup:opcache runs out of memory with the default memory_limit (128M) on larger applications
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with src/Instrument/ClassLoading/Opcache/FileCachePrimer.php, especially compileFile() and the finally block that restores settings. Check how the primer handles memory_limit while compiling the file set, then add a subprocess test that primes generated files under a low limit such as 32M. Done means the subprocess succeeds and the command explains the memory requirement when the limit is exceeded.
索引モデルが issue の本文から書いたものです。
説明
Found while building the Docker image of goaop/shop-demo-laravel (php:8.5-cli, Laravel 13.40, goaop-laravel-bridge 2.0.0, framework 4.0.0).
Problem
php artisan aop:warmup-opcache (the framework's cache:warmup:opcache on the application kernel) fails in the official PHP image, whose memory_limit is 128M:
Priming the opcache file cache /var/cache/opcache with 221 files of the AOP cache and 5525 files of the application.
production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2097152 bytes)
... at /app/vendor/goaop/framework/src/Instrument/ClassLoading/Opcache/FileCachePrimer.php:229
Line 229 is opcache_compile_file($file) in FileCachePrimer::compileFile(). With -d memory_limit=512M the same run compiles 5,599 files. The Symfony demo (about 2,500 files) stayed below 128M.
Cause
The primer runs with opcache.file_cache_only=1, so there is no shared memory. In that mode PHP keeps every script compiled by opcache_compile_file() in the memory of the process until the request ends. Memory grows linearly with the number of files: Composer's class map of a Laravel application already holds about 5,500.
Proposal
- The primer raises the memory limit for its run when it is lower than needed:
ini_set('memory_limit', '-1')or a generous value, restored in the existingfinallyblock that restores the other settings (FileCachePrimer.php:205-211). - Or compile in batches in child processes (more robust, more code).
- In any case, say in the command's help and in the error output when the memory limit is hit.
Acceptance
- A test (subprocess) that primes more files than fit into a low
memory_limit(e.g.-d memory_limit=32Mwith a few hundred generated files) succeeds. composer test,composer analyse.
- 主要言語
- PHP
- スター
- 1.7k
- フォーク
- 166
- 平均マージ
- 1日 1時間
- マージ済み PR(30日)
- 38
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
goaop/framework のほかの issue
-
Enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Bug To Be Discussed
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 4/5 1〜2日 初心者へのやさしさ 56/100
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
Enhancement Performance
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 1 日以内に返信
goaop/framework の issue をすべて見る
似ている issue
-
enhancement priority Sales
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Include flows spanning the full report time window対応中かも @somethingwithproof が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Cacti/plugin_flowview#306 ·
メンテナーはふだん 1 日以内に返信
-
bug origin: upstream priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
crazy-goat/workerman-bundle#1189 ·
メンテナーはふだん 1 日以内に返信