Connecting to PDO / MySQL database over unix-socket throws "a retry" error
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
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
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.
Hướng nghiên cứu
Điểm vào được báo cáo là PDO->__construct() khi kết nối tới MySQL thông qua Unix socket; hệ thống con liên quan là tiện ích mở rộng mysqlnd. Trước tiên, hãy tái hiện chuỗi kết nối tần suất cao trên PHP 8.5.9 và Debian 12, sau đó kiểm tra cách xử lý việc thử lại socket; được xem là hoàn tất khi chuỗi không còn trả về SQLSTATE[HY000] [2002] Resource temporarily unavailable.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- mysql, php
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 35/100