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
Deadlocks caused by bad ordering of address_current_token_balances upserts #1522
Comments
You can't delete either step. What you could do is look at the params |
Thanks for the elaborate answer! Just a quick thought before diving back into the code: splitting the transaction into one with consensus loss and another one with the actual block import would be an easy solution to the deadlock problem. |
You have too many writers to guarantee ordering if you split the transactions. You can't ensure that you take away consensus before adding it back with the normal blocks. |
Fixed via #1724 |
Despite fixes in #1296 and #1320 deadlocks still occur during block synchronization:
Apparently, realtime block fetcher upserts into
address_current_token_balances
table twice in the span of a huge transaction:The offending transaction hits the deadlock while upserting to the same table during the second upsert above:
I discovered token balance updating in two places in the codebase:
This seems to be causing unordered upserts and deadlocks.
Before going on and removing one of these code blocks, I would like to understand the purpose of this duplication and figure out, which one should actually be removed.
A comment from @KronicDeth, who is apparently the author of both code blocks would be very much appreciated.
The text was updated successfully, but these errors were encountered: