Bug #80412 [NEW]: PHP-FPM : PDO / Broken Pipe when DBMS ends the connection
| From: | heavy-traffic-website at yopmail dot com | Date: | Tue, 24 Nov 2020 23:00:16 +0000 |
| Subject: | Bug #80412 [NEW]: PHP-FPM : PDO / Broken Pipe when DBMS ends the connection | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-230593@lists.php.net to get a copy of this message | ||
From: heavy-traffic-website at yopmail dot com
Operating system: Debian 11
PHP version: 7.4.12
Package: PDO Core
Bug Type: Bug
Bug description:PHP-FPM : PDO / Broken Pipe when DBMS ends the connection
Description:
------------
Related to this very old bug reported 10 years ago
=> https://bugs.php.net/bug.php?id=53287
(johannes@php.net) was wrong - the bug still exists and no one fixed
it.
--> Please consider the bug onto the PHP side, not the DBMS side.
------------------------
new PDO("mysql:host=127.0.0.1;dbname=XXX", "XXX", "XXX", [
PDO::ATTR_PERSISTENT => true ]);
PHP-FPM have threads with broken persistent connections and SHOULD try
to reconnect a new one connection rather than CRASHING an exception in
the case where send of 5 bytes failed with errno=32 Broken pipe appens
in __construct.
Test script:
---------------
With php7.4-fpm, i have some threads and when i have a wide blank time
between DBMS and PHP, probably the timeout of the DBMS break the pipe
(default: 8h), however PHP/PDO don't care and throw an exception instead
of making a new one connection, inside each thread alive.
Currently, I have to try{ new PDO() }catch(){ new PDO() } to be working
without error, it sucks !
Expected result:
----------------
The PDO side CAN be patched, so this is a bug. It is expected that PDO
will try to reconnect silently if the case described appears, before
lauching any exception. And if any exception has to be launched, it will
certainly will not be these one but the new connection exception.
Actual result:
--------------
Catched Exception :
PDO::__construct(): send of 5 bytes failed with errno=32 Broken pipe
--
Edit bug report at https://bugs.php.net/bug.php?id=80412&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80412&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80412&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80412&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80412&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80412&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80412&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80412&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80412&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80412&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80412&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80412&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80412&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80412&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80412&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80412&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80412&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80412&r=mysqlcfg