Page MenuHomePhabricator

Send graceful shutdown signals to daemons in Phabricator
ClosedPublic

Authored by epriestley on Aug 12 2014, 2:34 AM.
Tags
None
Referenced Files
F14026263: D10228.diff
Fri, Nov 8, 12:45 AM
F14023046: D10228.id24614.diff
Wed, Nov 6, 10:01 PM
F14023045: D10228.id24613.diff
Wed, Nov 6, 10:01 PM
F14023044: D10228.id24617.diff
Wed, Nov 6, 10:01 PM
F13981348: D10228.id24613.diff
Sat, Oct 19, 3:57 PM
F13981248: D10228.id24614.diff
Sat, Oct 19, 3:10 PM
F13981235: D10228.id.diff
Sat, Oct 19, 3:05 PM
F13981230: D10228.id24614.diff
Sat, Oct 19, 3:03 PM
Subscribers

Details

Summary

Fixes T5855. Adds a --graceful N flag to phd stop and phd restart.

phd will send SIGINT, wait N seconds, SIGTERM, wait 15 seconds, and SIGKILL. By default, N is 15.

Test Plan
  • Ran bin/phd debug ... and used ^C to interrupt daemons. Saw graceful shutdown behavior, and abrupt termination on multiple ^C.
  • Ran bin/phd start, bin/phd stop and bin/phd restart with --graceful set to various things, notably 0. Saw graceful shutdowns on the CLI and in the web UI. With 0, abrupt shutdowns.

Diff Detail

Repository
rP Phabricator
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Send graceful shutdown signals to daemons in Phabricator.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: hach-que, btrahan.

Tried this out with --graceful 120. Is it intended that in the taskmaster log you'll see:

(2) Graceful shutdown in response to signal 2 (SIGINT).

but bin/phd restart will still be waiting for the daemon to exit? It seems like the process should quit after this and show "Daemon 1234 exited." as they exit.

In addition, the daemon showed a status of "Running" in the daemons app (the same one that reported the graceful shutdown).

In addition, it was only after the daemon got:

(15) Shutting down in response to signal 15 (SIGTERM).

that it moved to the status of "Exiting" in the daemons app.

(And it's still sitting at "Exiting" even though the process no longer exists)

Hrrm -- that's not expected, and not the behavior on my system.

If you bin/phd debug garbage and then ^C it, what happens?

Strangely enough, it has the expected behaviour when running a separate daemon as bin/phd debug, but not for any of the daemons started with bin/phd start or bin/phd restart.

By that I mean when running bin/phd debug and then doing bin/phd restart in another tab. I'll try ^C now.

src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
64

Also derp

151

Oh, this is the wrong constant.

When I do ^C I see:

sh: KILL: command not found
epriestley edited edge metadata.
  • Fix UI constants.
hach-que edited edge metadata.
This revision is now accepted and ready to land.Aug 12 2014, 3:13 AM
epriestley updated this revision to Diff 24617.

Closed by commit rP9309723ac477 (authored by @epriestley).