php / php/php-src

Connecting to PDO / MySQL database over unix-socket throws "a retry" error

Aperta
#22,981 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Extension: pdo_mysql Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Il punto di ingresso segnalato è PDO->__construct() durante la connessione a MySQL tramite un socket Unix; il sottosistema interessato è l’estensione mysqlnd. Inizia riproducendo la sequenza di connessione ad alta frequenza su PHP 8.5.9 e Debian 12, quindi esamina come vengono gestiti i tentativi di riconnessione del socket; il lavoro è completato quando la sequenza non restituisce più SQLSTATE[HY000] [2002] Resource temporarily unavailable.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
mysql, php
Ambito
databases
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Tranquilla
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.