php / php/php-src

Transfer closed for httpd parent and subrequest double bailout

Đang mở
#17,509 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

  • #17653 của @bukka — đã đóng, không merge
Bug SAPI: apache2handler
Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 15 giờ
Pull request đã merge (30 ngày)
103

Mô tả

Description

This can be recreated by setting memory_limit to 128MB and hitting virtual.php script that calls subrequest.php script

The following code:

<?php
// subrequest.php

$mep = str_repeat('test', 256 * 1000000);

echo count($mem);
<?php
// virtual.php

virtual('/subrequest.php');

echo "test";

$mep = str_repeat('test', 256 * 1000000);

echo "virtual!\n";

Resulted in this curl result:

* transfer closed with outstanding read data remaining
* Closing connection 0
curl: (18) transfer closed with outstanding read data remaining

The error logs showed following:

[Sat Jan 18 14:07:36.162766 2025] [php:error] [pid 86048:tid 86048] [client 127.0.0.1:48464] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted at /home/jakub/prog/php/81/Zend/zend_string.h:163 (tried to allocate 1024000032 bytes) in /home/jakub/prog/php/tests/apache2handler/basic/subrequest.php on line 3
[Sat Jan 18 14:07:36.162842 2025] [php:error] [pid 86048:tid 86048] [client 127.0.0.1:48464] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted at /home/jakub/prog/php/81/Zend/zend_string.h:163 (tried to allocate 1024000032 bytes) in /home/jakub/prog/php/tests/apache2handler/basic/virtual.php on line 7
/home/jakub/prog/php/81/Zend/zend_alloc.c(393) : Bailed out without a bailout address!

But I expected normal output with 2 errors for allowed memory size

I tested this with 8.1 but it will be the same for supported version I'm sure - will double check later.

PHP Version

PHP 8.1+

Operating System

Ubuntu 20.04

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện lỗi bằng cách để virtual.php gọi subrequest.php với giới hạn bộ nhớ 128MB, sau đó kiểm tra các đường dẫn được báo cáo trong Zend/zend_string.h và Zend/zend_alloc.c. So sánh đầu ra truyền tải và đầu ra lỗi của Apache với hai lỗi giới hạn bộ nhớ dự kiến, không có lỗi bailout-address hoặc phản hồi bị cắt ngắn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
apache, php
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.