Homec4science

Free task leases on "phd start"

Authored by epriestley <git@epriestley.com> on May 22 2014, 19:40.

Description

Free task leases on "phd start"

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.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5154

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

Details

Committed
epriestley <git@epriestley.com>May 22 2014, 19:40
Pushed
aubortJan 31 2017, 17:16
Parents
rPH890ae77a9a47: Don't fatal when viewing a moved document if the target does not exist or isn't…
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPH5e7b316fbed1: Free task leases on "phd start" (authored by epriestley <git@epriestley.com>).May 22 2014, 19:40