Garbage collection stops after exception in SoapClient
未关闭
还没有人认领这个 Issue。
Bug
Extension: soap
Status: Verified
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.1k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?php
class A
{
public $b;
}
class B
{
public $a;
}
function buildCycle()
{
$a = new A();
$b = new B();
$a->b = $b;
$b->a = $a;
}
function failySoapCall()
{
try {
new SoapClient('https://nowhere.inexistent.space/?WSDL');
}
catch (Exception) {
echo "Soap call failed\n";
}
}
function gc()
{
gc_collect_cycles();
echo "GC Runs: " . gc_status()['runs'] . "\n";
}
buildCycle();
gc();
buildCycle();
gc();
buildCycle();
gc();
failySoapCall();
buildCycle();
gc();
buildCycle();
gc();
buildCycle();
gc();
Resulted in this output:
GC Runs: 1
GC Runs: 2
GC Runs: 3
Soap call failed
GC Runs: 3
GC Runs: 3
GC Runs: 3
But I expected this output instead:
GC Runs: 1
GC Runs: 2
GC Runs: 3
Soap call failed
GC Runs: 4
GC Runs: 5
GC Runs: 6
The SOAP exception apparently stops the garbage collector. I experienced this problem with a large, long running process. Its memory usage is intensive but stable. Until it encounters a SOAP exception: its memory usage skyrockets, and gc_status() reports that no more gc run is done.
PHP Version
PHP 8.1.13
Operating System
Alpine 3.16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
在 PHP 8.1.13 和 Alpine 3.16 上,使用 SoapClient、gc_collect_cycles() 和 gc_status() 运行提供的 PHP 复现代码。首先跟踪异常路径及其与循环垃圾回收的交互。完成的标准是:失败的 SOAP 调用之后垃圾回收仍会继续运行,并且报告的循环计数与预期输出一致。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100