Page MenuHomePhabricator

Use stdio, not signals, to heartbeat from the daemons
ClosedPublic

Authored by epriestley on Feb 22 2015, 2:06 PM.
Tags
None
Referenced Files
F14105845: D11850.id28607.diff
Wed, Nov 27, 3:43 AM
Unknown Object (File)
Wed, Nov 27, 12:58 AM
Unknown Object (File)
Sun, Nov 24, 9:37 AM
Unknown Object (File)
Sun, Nov 24, 8:02 AM
Unknown Object (File)
Fri, Nov 22, 11:43 PM
Unknown Object (File)
Mon, Nov 18, 10:33 PM
Unknown Object (File)
Fri, Nov 15, 10:58 AM
Unknown Object (File)
Sun, Nov 10, 5:37 PM
Subscribers

Details

Summary

Ref T7352. We currently run one overseer per daemon. I want to run one overseer for a group of daemons, to reduce the minimum memory footprint of an instance.

One barrier is how hang detection works: we detect daemon hangs by requiring them to send a periodic heartbeat. If a daemon doesn't heartbeat for a while, we assume it has hung and restart it.

Currently, this heartbeat is sent by having the daemons send SIGUSR1 to the overseer. When the overseer receives the signal, it extends the deadline for the next heartbeat.

However, the overseer can't tell where the signal came from. Right now it can only come from one place, but in a world where overseers run multiple daemons it could have come from any of the children.

Instead of using signals, this turns the daemon's stdout (which we already consume) into a structured message pipeline, and sends the heartbeat over stdout.

In a future diff, the overseer will be able to attriubute heartbeats to the correct child process.

Test Plan
  • Ran daemon in the raw, saw sensible output.
  • Made daemon use plain echo, saw output get wrapped.
  • Artificially set heartbeat deadline to 10 seconds, saw heartbeating daemons continue running and hung daemons restart.

Diff Detail

Repository
rPHU libphutil
Branch
daemon1
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 4600
Build 4614: [Placeholder Plan] Wait for 30 Seconds

Event Timeline

epriestley retitled this revision from to Use stdio, not signals, to heartbeat from the daemons.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
btrahan edited edge metadata.
This revision is now accepted and ready to land.Feb 23 2015, 5:18 PM
This revision was automatically updated to reflect the committed changes.