HomePhorge

Fix an issue where PhabricatorWorkerLeaseQuery may lease different tasks than…

Description

Fix an issue where PhabricatorWorkerLeaseQuery may lease different tasks than it selects

Summary:
We lock tasks by setting leaseOwner to a unique value, but the value is currently unique-to-the-process rather than unique-to-the-query. This means that if a process leases a task, then leases another task, both tasks will have the same leaseOwner. This can cause an issue where we go to select the task we just leased and get the other task instead, if we aren't careful about the select construction.

We can avoid this by being clever and making sure the select is constructed correctly, but making the leaseOwner unique to the query is much simpler and more foolproof. This guarantees we always select only the rows we just leased.

Also remove PhabricatorGoodForNothingWorker since PhabricatorTestWorker fills its role of allowing things to be tested, and simplify the unit tests since we don't need to be clever about avoiding this issue any more.

Test Plan: Ran unit tests.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D3862

Details

Provenance
epriestleyAuthored on Nov 1 2012, 11:30 AM
themackabuPushed on Mar 25 2025, 8:07 PM
Parents
rPf0fdcf1a516c: Undumb the Drydock resource allocator pipeline
Branches
Unknown
Tags
Unknown

Event Timeline