cache:warmup:opcache runs out of memory with the default memory_limit (128M) on larger applications
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- PHP
- Stelle
- 1.7k
- Fork
- 166
- Merge medio
- 1g 1h
- PR unite (30g)
- 38
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di goaop/framework
-
Enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Bug To Be Discussed
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 4/5 1-2 giorni Idoneità per principianti 56/100
I maintainer di solito rispondono entro 1 giorno
-
Bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
I maintainer di solito rispondono entro 1 giorno
-
Enhancement Performance
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di goaop/framework
Issue simili
-
enhancement priority Sales
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Include flows spanning the full report time windowForse già presa @somethingwithproof l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
Cacti/plugin_flowview#306 ·
I maintainer di solito rispondono entro 1 giorno
-
bug origin: upstream priority: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
crazy-goat/workerman-bundle#1189 ·
I maintainer di solito rispondono entro 1 giorno