Page MenuHomePhabricator

Free task leases on "phd start"
ClosedPublic

Authored by epriestley on May 22 2014, 3:32 PM.
Tags
None
Referenced Files
F13141013: D9256.diff
Fri, May 3, 4:07 AM
Unknown Object (File)
Mon, Apr 29, 3:21 PM
Unknown Object (File)
Wed, Apr 24, 10:23 PM
Unknown Object (File)
Fri, Apr 19, 3:36 AM
Unknown Object (File)
Tue, Apr 9, 4:40 PM
Unknown Object (File)
Apr 2 2024, 9:49 PM
Unknown Object (File)
Mar 24 2024, 10:01 AM
Unknown Object (File)
Mar 2 2024, 9:13 PM
Subscribers

Details

Summary

Fixes T5154. Currently, "phd stop" terminates daemons relatively abruptly (and other things do too, like killing them). This can leave them with long leases that won't expire any time soon. Normally this isn't a big deal, since it just means an email or an import takes a bit longer (often 2 hours, but up to 24 hours) to run. However:

  • We've increased default lease durations a lot fairly recently -- the 2 hours used to be 15 minutes.
  • Harbormaster and Drydock add new types of tasks which are more dependent on other tasks, so waiting 2 hours for something to free up can hold up more stuff in queue.

When phd start is run, we can be confident (at least, in normal circumstances) that leases are safe to free, since we do a check. This undoes any damage done by abrupt stops in "phd stop" or by users or systems killing stuff.

(It would be nice to make "phd stop" more graceful at some point, but we always have to deal with abrupt termination in some cases no matter how gentle "phd stop" is.)

One sort-of-questionable thing here is that we don't distinguish between tasks which had an active lease and tasks which had been released, since the system itself does not make a distiction. So, for example, if you have a task that retries 5 times and waits an hour between retries, you'll get a retry on every phd start now, and could exhaust them all in a few minutes if you cycle phd start aggressively. I think this is OK. In the future, we could try to distinguish between these types of tasks, and only free the ones with active leases.

Test Plan
  • Used phd start normally, saw it free leases.
  • Used phd start, killed it real quick so no taskmasters spawned, ran it again an saw no leases freed.
  • Used phd start --keep-leases.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Free task leases on "phd start".
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.

Sounds good to me. On the questionable thing, it seems okay to me. For example, maybe that's even a feature of phd start ? "If you want to retry some jobs immediately, run phd start"

This revision is now accepted and ready to land.May 22 2014, 4:53 PM
epriestley updated this revision to Diff 21981.

Closed by commit rP5e7b316fbed1 (authored by @epriestley).