1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00
No description
Find a file
epriestley 69538274c1 Garbage collect old daemon records based on modification date, not creation date
Summary:
Fixes T12720. Currently, old daemon records are collected based on creation date. By default, the GC collects them after 7 days.

After T12298, this can incorrectly collect hibernating daemons which are in state "wait".

In all cases, this could fail to collect daemons which are stuck in "running" for a long time for some reason. This doesn't seem to be causing any problems right now, but it makes me hesitant to do "dateCreated + not running or waiting" since that might make this become a problem, or make an existing problem with this that we just haven't bumped into worse.

Daemons always heartbeat periodically and update their rows, so `dateModified` is always fresh, so collect rows based only on modification date.

Test Plan:
  - Ran daemons (`bin/phd start`).
  - Waited a few minutes.
  - Verified that hibernating daemons in the "wait" state had fresh timestamps.
  - Verified that very old daemons still got GC'd properly.

```
mysql> select id, daemon, status, FROM_UNIXTIME(dateCreated), FROM_UNIXTIME(dateModified) from daemon_log;
+-------+--------------------------------------+--------+----------------------------+-----------------------------+
| id    | daemon                               | status | FROM_UNIXTIME(dateCreated) | FROM_UNIXTIME(dateModified) |
+-------+--------------------------------------+--------+----------------------------+-----------------------------+
| 73377 | PhabricatorTaskmasterDaemon          | exit   | 2017-05-19 10:53:03        | 2017-05-19 12:38:54         |
...
| 73388 | PhabricatorRepositoryPullLocalDaemon | run    | 2017-05-26 08:43:29        | 2017-05-26 08:45:30         |
| 73389 | PhabricatorTriggerDaemon             | run    | 2017-05-26 08:43:29        | 2017-05-26 08:46:35         |
| 73390 | PhabricatorTaskmasterDaemon          | wait   | 2017-05-26 08:43:29        | 2017-05-26 08:46:35         |
| 73391 | PhabricatorTaskmasterDaemon          | wait   | 2017-05-26 08:43:33        | 2017-05-26 08:46:33         |
| 73392 | PhabricatorTaskmasterDaemon          | wait   | 2017-05-26 08:43:37        | 2017-05-26 08:46:31         |
| 73393 | PhabricatorTaskmasterDaemon          | wait   | 2017-05-26 08:43:40        | 2017-05-26 08:46:33         |
+-------+--------------------------------------+--------+----------------------------+-----------------------------+
17 rows in set (0.00 sec)
```

Note that:

  - The oldest daemon is <7 days old -- I had some other older rows but they got GC'd properly.
  - The hibernating taskmasters (at the bottom, in state "wait") have recent/more-current `dateModified` dates than their `dateCreated` dates.

Reviewers: chad, amckinley

Reviewed By: chad

Maniphest Tasks: T12720

Differential Revision: https://secure.phabricator.com/D18024
2017-05-26 09:18:26 -07:00
bin Add a profileimage generation workflow for the cli 2017-03-04 15:43:13 -08:00
conf Support "ssl.chain" in Aphlict configuration 2016-04-14 10:41:21 -07:00
externals Apply the wordwrap() hack for "To" to PHPMailerLite 2017-03-16 10:56:25 -07:00
resources Add a little style to Phriction ToC menu 2017-05-26 09:17:30 -07:00
scripts Add a profileimage generation workflow for the cli 2017-03-04 15:43:13 -08:00
src Garbage collect old daemon records based on modification date, not creation date 2017-05-26 09:18:26 -07:00
support Update rate limiting for APCu and X-Forwarded-For 2017-04-21 20:39:14 -07:00
webroot Add a little style to Phriction ToC menu 2017-05-26 09:17:30 -07:00
.arcconfig Set "history.immutable" to "false" explicitly in .arcconfig 2016-08-03 08:12:49 -07:00
.arclint Begin adding test coverage to GitHub Events API parsers 2016-03-09 09:30:07 -08:00
.arcunit Use the configuration driven unit test engine 2015-08-11 07:57:11 +10:00
.editorconfig Fix text lint issues 2015-02-12 07:00:13 +11:00
.gitignore Make i18n string extraction faster and more flexible 2016-07-04 10:23:30 -07:00
LICENSE Fix text lint issues 2015-02-12 07:00:13 +11:00
NOTICE Update Phabricator NOTICE file to reflect modern legal circumstances 2014-06-25 13:42:13 -07:00
README.md Remove push to IRC from "readme.md" too 2015-10-24 18:39:16 -07:00

Phabricator is a collection of web applications which help software companies build better software.

Phabricator includes applications for:

  • reviewing and auditing source code;
  • hosting and browsing repositories;
  • tracking bugs;
  • managing projects;
  • conversing with team members;
  • assembling a party to venture forth;
  • writing stuff down and reading it later;
  • hiding stuff from coworkers; and
  • also some other things.

You can learn more about the project (and find links to documentation and resources) at Phabricator.org

Phabricator is developed and maintained by Phacility.


SUPPORT RESOURCES

For resources on filing bugs, requesting features, reporting security issues, and getting other kinds of support, see Support Resources.

NO PULL REQUESTS!

We do not accept pull requests through GitHub. If you would like to contribute code, please read our Contributor's Guide.

LICENSE

Phabricator is released under the Apache 2.0 license except as otherwise noted.