php / php/php-src

Garbage collection stops after exception in SoapClient

オープン
#10,026 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: soap Status: Verified
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

PHP 8.1.13 および Alpine 3.16 で、提供されている PHP の再現コードを SoapClient、gc_collect_cycles()、gc_status() とともに実行します。まず、例外の経路と、循環ガベージコレクションとの相互作用を追跡します。失敗した SOAP 呼び出しの後もガベージコレクションの実行が継続し、報告されたサイクル数が期待される出力と一致すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。