This project is archived and is in readonly mode.

#6651 new
Michael Villar

Thread-safe problem with transactions

Reported by Michael Villar | March 30th, 2011 @ 12:01 PM

I made a simple script to illustrate the problem.
http://sht.tl/8A8kC

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.
http://sht.tl/unV

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.
http://sht.tl/6rMD

Thanks for reading. Hope I'm not wrong.

Config:
ActiveRecord 3.0.5
Postgresql
EventMachine

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages