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
Unknown Object (File)
Wed, Nov 20, 2:08 PM
Unknown Object (File)
Wed, Nov 20, 9:29 AM
Unknown Object (File)
Fri, Nov 15, 10:55 PM
Unknown Object (File)
Mon, Nov 11, 8:09 PM
Unknown Object (File)
Fri, Nov 8, 12:45 AM
Unknown Object (File)
Wed, Nov 6, 10:01 PM
Unknown Object (File)
Wed, Nov 6, 10:01 PM
Unknown Object (File)
Wed, Nov 6, 10:01 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
Branch
grace1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 2163
Build 2167: [Placeholder Plan] Wait for 30 Seconds

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
60

Also derp

147

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).