Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Thread-safe problem with transactions

#6651

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

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

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Michael Villar
    Michael Villar

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

    March 30th, 2011 @ 12:32 PM