Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Thread-safe problem with transactions #981

lighthouse-import opened this Issue May 16, 2011 · 1 comment


None yet
1 participant

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6651
Created by Michael Villar - 2011-03-30 11:01:31 UTC

I made a simple script to illustrate the problem.

The problem is the script blocks just before "project.save" after a while.
I found out (after a fucking time) that the problem occured because of the BEGIN COMMIT stuff around a UPDATE sql query.
I think, that two projects want to be saved at the same time, and the first query is not commited yet, so there are two BEGIN started.

We should synchronize the transactions through the threads.
I made a terrible fix that I don't like but which works. I don't know ActiveRecord code so I wanted something simple.

Thanks for reading. Hope I'm not wrong.

ActiveRecord 3.0.5

Imported from Lighthouse.
Comment by Michael Villar - 2011-03-30 11:32:09 UTC

MMh, my fix doesn't work when transaction's yield is making transactions too of course.. deadlock.

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