Page MenuHomePhabricator

Lock resources briefly while acquiring leases on them to prevent acquiring near-death resources
ClosedPublic

Authored by epriestley on Feb 13 2018, 7:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 2:50 AM
Unknown Object (File)
Tue, Apr 16, 11:13 AM
Unknown Object (File)
Wed, Apr 3, 12:19 PM
Unknown Object (File)
Sat, Mar 30, 6:51 PM
Unknown Object (File)
Sat, Mar 30, 6:51 PM
Unknown Object (File)
Sat, Mar 30, 6:50 PM
Unknown Object (File)
Fri, Mar 29, 7:43 PM
Unknown Object (File)
Wed, Mar 27, 11:37 PM
Subscribers
Restricted Owners Package
Tokens
"Mountain of Wealth" token, awarded by timhirsh.

Details

Summary

Depends on D19078. Ref T13073. Currently, there is a narrow window where we can acquire a resource after a reclaim has started against it.

To prevent this, briefly lock resources before acquiring them and make sure they're still good. If a resource isn't good, throw the lease back in the pool.

Test Plan

This is tricky. You need:

  • Hoax blueprint with limits and a rule where leases of a given "flavor" can only be satisfied by resources of the same flavor.
  • Reduce the 3-minute "wait before resources can be released" to 3 seconds.
  • Limit Hoaxes to 1.
  • Allocate one "cherry" flavored Hoax and release the lease.
  • Add a sleep(15) to releaseResource() in DrydockResourceUpdateWorker, after the canReclaimResource() check, with a print.

Now:

  • Run bin/phd debug task in two windows.
  • Run bin/drydock lease --type host --attributes flavor=banana in a third window.
  • This will start to reclaim the existing "cherry" resource. Once one of the phd windows prints the "RECLAIMING" message run bin/drydock lease --type host --attributes flavor=cherry in a fourth window.
  • Before patch: the "cherry" lease acquired immediately, then was released and destroyed moments later.
  • After patch: the "cherry" lease yields.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a subscriber: Restricted Owners Package.Feb 13 2018, 7:11 PM
epriestley retitled this revision from Lock resources breifly while acquiring leases on them to prevent acquiring near-death resources to Lock resources briefly while acquiring leases on them to prevent acquiring near-death resources.Feb 13 2018, 7:14 PM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 13 2018, 9:22 PM
This revision was automatically updated to reflect the committed changes.