[GIT-PULLS] [php-src] PR #22753: Fix GH-22631: ext/mysqli: fix corruption of num_active_persistent when using real_connect
[email protected] (bavis-m)
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <stdFuoIajdMmnkwfnYnB7d7BJSeCNU5tcgxxexP2ESQ@main.internal.php.net> |
Pull Request: https://github.com/php/php-src/pull/22753 Author: bavis-m Fix GH-22631: ext/mysqli: mysqli double increments num_active_persistent... In mysqli_common_connect(), when is_real_connect is set and a persistent connection is requested, both the persistent connection branch and the normal function flow (in the end: label) increment the num_active_persistent counter. num_active_persistent is also decremented once as a result of cleaning up old persistent connection state, but this still results in the counter growing by 1 every time we reuse an existing connection, and becoming invalid. This can cause later non-cached persistent connection attempts to fail the max_persistent limit check, depsite there not actually being that many persistent connections. This commit adds a flag from_pool which is set when a connection is found in the persistent connection pool, and which prevents the counter increment in the end: label from firing. Fixes GH-22631