Bug #81155 [NEW]: Mysql close is NOT synchronous

From: Date: Thu, 17 Jun 2021 14:35:31 +0000
Subject: Bug #81155 [NEW]: Mysql close is NOT synchronous
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234461@lists.php.net to get a copy of this message
From: video dot ice dot power at seznam dot cz Operating system: any PHP version: 8.0.7 Package: PDO MySQL Bug Type: Bug Bug description:Mysql close is NOT synchronous Description: ------------ Mysql close is NOT synchronous - it does NOT wait until the connection is closed/released by the database server which causes more simultaneous connections than needed from a script than connect/disconnect from the same database often. An example of such usecase is unit testing. I have tested also PostgreSQL. This PDO driver handles close synchronously/ok (SQL to limit connections: ALTER ROLE user CONNECTION LIMIT 1). MySQL driver needs to be fixed as even server limit of 2 is not enough, currently limit of like 5 is needed even if there is no more than 1 simultaneous client connection. Test script: --------------- # 1. limit connection limit to 1 php -r '(new PDO("mysql:host=mysql", "user", "pass"))->exec("ALTER USER '"'"'user'"'"'@'"'"'%'"'"' WITH MAX_USER_CONNECTIONS 1");' # 2. connect/disconnect often for ($i = 0; $i < 10000; $i++) { (new PDO("mysql:host=mysql", "user", "pass"))->exec("SELECT 1"); } Expected result: ---------------- no error Actual result: -------------- connection limit is exhausted about every 1000th connection -- Edit bug report at https://bugs.php.net/bug.php?id=81155&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81155&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81155&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81155&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81155&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81155&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81155&r=support Expected behavior: https://bugs.php.net/fix.php?id=81155&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81155&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81155&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81155&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81155&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81155&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81155&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81155&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81155&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81155&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81155&r=mysqlcfg

« previous php.bugs (#234461) next »