Connecting to PDO / MySQL database over unix-socket throws "a retry" error
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
Resulted in this output:
Error message: SQLSTATE[HY000] [2002] Resource temporarily unavailable
Error stack trace:
#0 /location-to-php.php(43): PDO->__construct()
#xx: our code
But I expected this output instead:
No crash.
This is a bug in mysqlnd in that it returns a "2002" error code (I looked into the code -- it's a "try again" code, that is a look / backoff should be taken). This happens when connecting to MySQL using a unix socket. And it happens when a high-frequency of calls are made in short succession.
Ideally a unix-socket should be opened once per process and all communication should happen on that socket (rather than opening and closing it over and over again). And "retry" "errors" (not an error) should be handled correctly.
I haven't dug into the mysqlnd extension into how to fix this yet. If someone wants to jump on this first, that would be appreciated. Otherwise I'll dig into it next week.
PHP Version
8.5.9
Operating System
Debian 12
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
報告されたエントリポイントは、Unix ソケット経由で MySQL に接続する際の PDO->__construct() です。関連するサブシステムは mysqlnd 拡張機能です。まず PHP 8.5.9 と Debian 12 で高頻度の接続シーケンスを再現し、その後、ソケットの再試行がどのように処理されるかを調査します。完了条件は、シーケンスが SQLSTATE[HY000] [2002] Resource temporarily unavailable を返さなくなることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- mysql, php
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100