-
Notifications
You must be signed in to change notification settings - Fork 158
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
Fixes Engine.release method to release connection in any way #558
Conversation
…est_release_broken_connection to reproduce this case.
Codecov Report
@@ Coverage Diff @@
## master #558 +/- ##
==========================================
+ Coverage 94.35% 94.36% +0.01%
==========================================
Files 27 27
Lines 3740 3747 +7
Branches 171 170 -1
==========================================
+ Hits 3529 3536 +7
Misses 179 179
Partials 32 32
Continue to review full report at Codecov.
|
@vir-mir , can you, please, take a look? |
this behavior is fixed in PR #548 |
This PR isn't directly corresponds to the #332, so maybe there is a misunderstanding. In #548 |
@vir-mir I checked out I see that you added Lines 337 to 348 in 0c98538
If await self._transaction.rollback() fails, self._engine.release(self) isn't called, connection isn't returned to the pool, pool gets exhausted.
You can reproduce this with my |
BTW, without proper connection release |
thank. I will try to solve it soon. |
@vir-mir hello! Did you have time for this PR? |
+1 for this issue |
+1 for the issue. @vir-mir Could you review PR, please? |
The same fix was applied in #756 and released as |
Fixes #332 error.
The problem is that
Engine.release
method raisesInvalidRequestError
exception before releasing connection. This may happen not only when user did something wrong, but also when connection becomes broken. Pool becomes exhausted and application stops responding.I think that it doesn't matter who is guilty, connection should be released in any way, and
Pool.release
also checks connection's state, and if it is not in IDLE state, pool closes connection.I've added
test_release_broken_connection
to reproduce this error. CurrentlyPool.release
emitsResourceWarning
, I think that it is enough.