You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opcache_invalidate is not safe under high concurrencies #134
This was first raised in the FrankenPHP Repo, where @robsontenorio noticed that when stress testing, the application would end up in a memory corruption after a while.
This happens due to opcache_invalidate() being called each request leading to a buildup in memory that eventually leads to an opcache_reset().
opcache_reset() is currently not really safe under concurrency (both in FPM and FrankenPHP, so I'd recommend avoiding an opcache_reset if possible in production environments.
Also when testing with the reproducer, I noticed that the path passed to opcache_invalidate was that of a Blade file (which makes it look unitended)
In addition to the crash issue caused by opcache_invalidate() mentioned by @AlliBalliBaba, this also results in a gradual increase in memory usage over time. cc @nunomaduro
This can easily be reproduced like this.
ab -n 10000 -c 20 http://localhost:8016/
I have also noticed the same opcache_invalidate() in the Laravel Framework itself, that also contributes to the gradual increase in memory usage. It was introduced by this PR laravel/framework#50665
Activity
robsontenorio commentedon May 14, 2025
In addition to the crash issue caused by
opcache_invalidate()mentioned by @AlliBalliBaba, this also results in a gradual increase in memory usage over time. cc @nunomaduroThis can easily be reproduced like this.
I have also noticed the same
opcache_invalidate()in the Laravel Framework itself, that also contributes to the gradual increase in memory usage. It was introduced by this PR laravel/framework#50665Cc @jessarcher
https://github.com/laravel/framework/blob/df12a087731b37708cfbba72172a4c381363fed2/src/Illuminate/Support/ServiceProvider.php#L562
But mostly, the main issue about memory usage is about Volt.