-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Can't force reconnect while within transaction and connection lost #15865
Comments
what do you suggest? how do you think we should handle this? |
I was working on a PR to add a $force = true param to DB::reconnect(). |
There is another PR already open to fix this I believe? #15511 |
#15511 sounds to be different. My PR lets the client code do this: try {
DB::beginTransaction();
...
//possibly nested transactions are here without any extra try-catch
...
DB::commit();
} catch (Exception $e) {
try {
while(DB::transactionLevel() > 0) DB::rollBack();
} catch (Exception $e) {
//This looks only possible after the pull request: to handle lost connection or any other reason that makes rollbacks impossible.
// Without this PR the application must be aborted, a terrible situation for daemon workers as an example.
DB::reconnect(true);
throw $e;
}
} |
@halaei was this taken care of by any of your PRs? |
Does github have a problem with replies via email? I answered 2ice via email but both are failed I think? |
Yes check this please: #15931
It is simple and hopefully working. This issue is now closed for 5.3. I may
not try for a proper change for 5.1 though.
|
Description:
It seems that the framework don't provide any way to reconnect to database while within a transaction and connection is lost.
Steps To Reproduce:
It is hard to reproduce. Not having the option of handling such a situation is bad. It may happen if someone is working with daemon queue workers and for some reason a transaction is not closed within a job and is leaked out. It may also happen for queries that are expected to take long.
The text was updated successfully, but these errors were encountered: