zend_types.h:1383: zend_gc_delref: Assertion `p->refcount > 0' failed upon memory exhaustion
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách chạy trình tái hiện PHP được cung cấp với bản build debug và các giới hạn bộ nhớ đã nêu. Kiểm tra Zend/zend_gc.c tại dòng 356 và zend_types.h tại dòng 1383, sau đó so sánh hành vi với issue #16835. Được coi là hoàn tất khi tình trạng cạn kiệt bộ nhớ báo cáo fatal error mà không kích hoạt refcount assertion hoặc abort.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
The following code:
<?php
class Node {
public $parent = NULL;
public $children = array();
function __construct(?Node $parent=NULL) {
if ($parent) {
$parent->children[] = $this;
}
$this->children[] = $this;
}
function __destruct() {
$this->children = NULL;
}
}
define("MAX", 16);
for ($n = 0; $n < 20; $n++) {
$top = new Node();
for ($i=0 ; $i<MAX ; $i++) {
$ci = new Node($top);
for ($j=0 ; $j<MAX ; $j++) {
$cj = new Node($ci);
for ($k=0 ; $n ?? (0 >> $i) & $n ?? $n ?? 20 ?? MAX<MAX ; $k++) {
$ck = new Node($cj);
}
}
}
echo "$n\n";
}
echo "ok\n";
?>
Resulted in this output:
0
Fatal error: Allowed memory size of 97517568 bytes exhausted at /home/user/software/php-debug-noasan/src/Zend/zend_gc.c:356 (tried to allocate 4096 bytes) in /tmp/bug.php on line 27
Stack trace:
#0 {main}
php: /home/user/software/php-debug-noasan/src/Zend/zend_types.h:1383: zend_gc_delref: Assertion `p->refcount > 0' failed.
Aborted (core dumped)
But I expected this output instead:
Fatal error: Allowed memory size of 97517568 bytes exhausted at /home/user/software/php-debug-noasan/src/Zend/zend_gc.c:356 (tried to allocate 4096 bytes) in /tmp/bug.php on line 27
This bug seems to be dependent on how much memory you give php, through grid searching I found these values of memory trigger the bug
93M, 94M, 127M, 128M, 159M, 160M, 193M-196M, 243M-248M, 287M-290M, 333M-338M, 383M-390M
Looks very similar to https://github.com/php/php-src/issues/16835 but unsure about same root cause
PHP Version
PHP 8.5.10 (cli) (built: Sep 5 2026 19:25:14) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.5.10, Copyright (c) Zend Technologies
with Zend OPcache v8.5.10, Copyright (c), by Zend Technologies
34308a6666b2d489c509541ea9befea9e2b42348
Operating System
Ubuntu 24.04
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 115
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của php/php-src
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
Bug Status: Needs Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Bug Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Flaky hrtime.phpt test Đang mởBug Category: Tests Status: Verified
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Bug SAPI: fpm Status: Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
duckdb/duckdb-wasm#2258 ·
-
how does install.sh work Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
rofl0r/microsocks#110 ·
-
OTA is not aborted correctly Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
espressif/esp-aws-iot#261 ·
-
os:linux
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
mpv-player/mpv#18510 · 2 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100