-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
DB::rollback() it's doesn't work in concurrent access #25900
Comments
Hi, Can you provide some exact code to replicate this? |
I'm worried about |
2tables:
Complete the log:
Result:
|
I think I have a lock problem with the transaction, i use try{} catch(\Exception $e){} has problem? |
This code:
Means that it will always throw an exception? |
i forget return true,It has been updated |
Sorry, but its still not clear what the actual issue is here. As @sisve said - it looks like your doing something with threads within the one call? That's unlikely to work. If you can provide a clearer and simple demostration of what the bug is in the framework, we can reopen the ticket. |
My project env:
1.laravel 5.7.6
2.mysql 8.0.12 The transaction level RR
3.php 7.1.22
Description :
The problem is the first transaction is success execute。
second and three transaction is rollback,but they insert
the order table record still in database。
I don't know why the transaction rolled back the data is still there。
logging:
I use three threads to simulate ordering,
this is simplified version my log。
[2018-10-03 17:44:13] dev.INFO: php-thread-id-32993 transaction start
[2018-10-03 17:44:13] dev.INFO: php-thread-id-33136 transaction start
[2018-10-03 17:44:13] dev.INFO: 32993 GET X-LOCK
[2018-10-03 17:44:13] dev.INFO: php-thread-id-32643 transaction start
... do business (like insert order table)
[2018-10-03 17:44:13] dev.INFO: 32643 GET X-LOCK
[2018-10-03 17:44:13] dev.INFO: 33136 GET X-LOCK
[2018-10-03 17:44:13] dev.INFO: 32993 commit success
At this point transaction 1 has completed the commit,
next second and three transaction will be
... do business (like insert order table)
But they have no balance to pay the order,so they will be rollback。
[2018-10-03 17:44:13] dev.INFO: php-thread-id-33136 rollback
[2018-10-03 17:44:13] dev.INFO: php-thread-id-32643 rollback
All three processes perform the same logic
1.Place the order
2.pay
3.commit or rollback
The text was updated successfully, but these errors were encountered: