Bug #8840
closed[API] Locking job doesn't lock record
Description
API server Job.lock uses a "transaction" but this doesn't guarantee atomic read-update-write operations. Need to use "with_lock" instead.
http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html
with_lock "Wraps the passed block in a transaction, locking the object before yielding. You can pass the SQL locking clause as argument (see lock!)."
lock! "Obtain a row lock on this record. Reloads the record to obtain the requested lock. Pass an SQL locking clause to append the end of the SELECT statement or pass true for “FOR UPDATE” (the default, an exclusive row lock). Returns the locked record.
Implemented in branch 8840-lock-job-record.
Updated by Peter Amstutz about 9 years ago
- Description updated (diff)
- Story points set to 0.5
Updated by Brett Smith about 9 years ago
- Assigned To set to Peter Amstutz
- Target version set to 2016-04-13 sprint
Updated by Brett Smith about 9 years ago
505b768 looks great, please merge. Thanks.
https://ci.curoverse.com/job/developer-test-job/98/console (failed in a FUSE test, but that looks like a teardown race condition or similar to me)
Updated by Peter Amstutz about 9 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
Applied in changeset arvados|commit:c020dd4470a5f8cbcfe15e764553622828f69ab5.