opcache_invalidate is not safe under high concurrencies
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 领域
- backend, performance
调研方向
检查 src/ComponentFactory.php 第 35 行,并审阅链接的 FrankenPHP issue 和 reproducer,以了解在请求期间如何调用 opcache_invalidate。对 reproducer 进行压力测试,包括使用 PostgreSQL 或 MySQL 的情况,并验证在高并发下,产生的行为不再导致不安全的 opcache 重置或内存损坏。
由索引模型根据 Issue 内容生成。
描述
Volt Version
1.7.1
Laravel Version
12.10.2
PHP Version
8.4.7
Database Driver & Version
No response
Description
This issue is specifically about this line in Volt. It would be nice if it can be avoided in productive environments: https://github.com/livewire/volt/blob/0ab9d34c53f87444017270a2178250a19f3083ec/src/ComponentFactory.php#L35
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)
Steps To Reproduce
You can use the reproducer provided by @robsontenorio https://github.com/robsontenorio/paper.mary-ui.com/tree/franken-bug
It will take a while for the corruption to appear, using postgres/mysql instead of sqlite will make it happen faster.
- 主要语言
- PHP
- 星标
- 423
- 派生
- 36
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
livewire/volt 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 72/100
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 38/100
相似的 Issue
-
sync-en
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
UX
难度 2/5 1-3 小时 新手友好度 72/100
ProfessionalWiki/NeoWiki#1573 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 68/100