php / php/php-src

php-fpm fail to process uris above 32kb in length

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

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

Bug SAPI: fpm Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.1k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

Assuming php-fpm and nginx configured to allow large URLs ( http{ large_client_header_buffers 8 999k; ...} )
The following code:

<?php
$url = "http://localhost/?a=" . str_repeat("a", 33*1024);
$ch = curl_init($url);
curl_exec($ch);

Resulted in

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.22.1</center>
</body>
</html>

and /var/log/nginx/error.log containing

2023/12/20 06:15:30 [error] 7980#7980: *32033 writev() failed (32: Broken pipe) while sending request to upstream, client: 162.248.164.115, server: localhost, request: "GET /?a=aaaaaaaaaa(...)

and nothing in /var/log/php8.2-fpm.log

But I expected... a notice in the php-fpm log that something went wrong? and maybe a HTTP 414 Request-URL too long error instead of a 502 Bad Gateway ?

PHP Version

PHP 8.2.7

Operating System

Debian 12

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

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

はじめの一歩

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

調査の方向性

まず、PHP 8.2.7、php-fpm、および記載された nginx のバッファ設定を使用して 33 KB の URI を再現します。php-fpm と nginx がサイズ超過のリクエストをどのように処理するかを追跡し、報告された nginx と php-fpm のログを確認します。完了の条件は、原因不明の 502 になるのではなく、障害が適切なレスポンスで処理・報告されることです。

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

評価

技術スタック
nginx, php
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

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

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