Skip to content
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

maraidb deadlocks #1238

Open
pushcx opened this issue Jan 5, 2024 · 0 comments
Open

maraidb deadlocks #1238

pushcx opened this issue Jan 5, 2024 · 0 comments

Comments

@pushcx
Copy link
Member

pushcx commented Jan 5, 2024

lobsters/lobsters-ansible#39

I wanted to cross-post this bug here because I can't just move it. It's in the Rails code, but all the tech details are already over there.

This deadlock happens because comment (and, much more rarely, story) creation is locking tables in a different order than vote creation (slash updating?). Maybe because of assigning the user's initial upvote or some memoized value like score/karma/votes/number of comments/etc.

The job here is to vote/unvote stories and comments in dev, and read the rails server log for the order that tables are touched in. Then same for story and comment posting. I am almost certain that will uncover tables accessed in a different order. Just posting those notes as a comment here would be very helpful!

If that is indeed the cause of the deadlock, then we have to shlep through the controllers and callbacks to figure out how to reorder, simplify, or break apart the transactions. Probably nothing even needs to be in a transaction, we're just getting it from Rails by default. But since I touched all the score code in 20c1590 I think voting should always work by doing score += 1 or score = sum(votes) rather than an unsafe select ... add 1 in ruby ... update, so a transaction is unneeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant