-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: deallocate mysqli prepared statement #6681
bugfix: deallocate mysqli prepared statement #6681
Conversation
c3b7675
to
d92e954
Compare
cb120c9
to
ea38c64
Compare
Thank you. Can you try to rebase your bugfix onto the 3.9.x branch? |
a5e719b
to
d41af03
Compare
Re-based the PR to point to Please have a look if you like the wording of the comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look at the PHPCS report.
1a186f3
to
8b453c7
Compare
Can you look into the test failures on PHP 7.4? |
8b453c7
to
8fd19f9
Compare
I think the error messages has changed. I pushed a change to the test to expect a different error message <8.0. Hard to test, I cannot replicate that setup locally easily. |
Still failing.
What setup? PHP 7.4? What OS are you on? |
dab3355
to
29fe1e0
Compare
I found a docker way to replicate it. With some docker magic. My current attempt is with a deprecated PHPUnit function. Which will throw an E_DEPRECATION. @derrabus do you have any suggestion on how to make this prettier? if (PHP_VERSION_ID < 80000) {
$this->expectError();
$this->expectErrorMessage('mysqli_stmt::execute(): Couldn\'t fetch mysqli_stmt');
} else {
$this->expectException(Error::class);
$this->expectExceptionMessage('mysqli_stmt object is already closed');
} |
I would propose marking the test as skipped for 7.4, not ideal but I don't see a way to do properly. |
Long running processes might hit the `max_prepared_stmt_count` due not deallocating the statement correctly.
29fe1e0
to
845ca16
Compare
I've pushed a fix for your test. |
Thank you, @petermein! |
* 3.9.x: bugfix: deallocate mysqli prepared statement (#6681)
* 3.9.x: bugfix: deallocate mysqli prepared statement (doctrine#6681)
* 3.9.x: bugfix: deallocate mysqli prepared statement (doctrine#6681)
* 4.2.x: bugfix: deallocate mysqli prepared statement (#6681)
* 4.3.x: bugfix: deallocate mysqli prepared statement (#6681)
Thank you for the merge, I contemplated overriding the error reporting but I deemed it too rigorous 😅 |
Long running processes might hit the
max_prepared_stmt_count
due not deallocating the statement correctly.Summary
For postgres there was an implementation to deallocate prepared statements to prevent hitting a any limits. This was not the case for the
mysqli
drivers. Which can suffer from the same problem.In this PR a
mysqli_stmt_close
is added to properly cleanup any open prepared statement.A similar approach was implemented for PostgreSQL in this PR #5893