Project

General

Profile

Actions

Bug #8840

closed

[API] Locking job doesn't lock record

Added by Peter Amstutz almost 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Story points:
0.5

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.


Subtasks 1 (0 open1 closed)

Task #8856: Review 8840 branchResolvedBrett Smith03/30/2016Actions
Actions #1

Updated by Peter Amstutz almost 8 years ago

  • Description updated (diff)
  • Story points set to 0.5
Actions #2

Updated by Brett Smith almost 8 years ago

  • Assigned To set to Peter Amstutz
  • Target version set to 2016-04-13 sprint
Actions #3

Updated by Peter Amstutz almost 8 years ago

  • Description updated (diff)
Actions #4

Updated by Peter Amstutz almost 8 years ago

  • Description updated (diff)
Actions #5

Updated by Brett Smith almost 8 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)

Actions #6

Updated by Peter Amstutz almost 8 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset arvados|commit:c020dd4470a5f8cbcfe15e764553622828f69ab5.

Actions

Also available in: Atom PDF