Page MenuHomePhabricator

Make parsing of daemon PIDs more robust
ClosedPublic

Authored by epriestley on Feb 17 2015, 7:32 PM.
Tags
None
Referenced Files
F15466515: D11786.diff
Thu, Apr 3, 6:26 AM
F15432908: D11786.id.diff
Mon, Mar 24, 8:11 PM
F15425441: D11786.id28411.diff
Sun, Mar 23, 4:43 AM
F15418272: D11786.id28429.diff
Thu, Mar 20, 10:09 PM
F15407737: D11786.diff
Tue, Mar 18, 7:14 PM
F15407570: D11786.id.diff
Tue, Mar 18, 6:25 PM
F15400882: D11786.diff
Mon, Mar 17, 2:29 PM
Unknown Object (File)
Feb 9 2025, 6:04 PM
Subscribers

Details

Summary

In production on the cluster, we get output like this:

  1 process1
 22 process2
333 process3

That is, the PIDs are right-aligned. In this case, the explode(...) splits the line " 1 process1" on the first space, and we end up with an empty PID.

We later try to kill PID 0, which kills us.

Instead, trim.

Also, be slightly more liberal in splitting.

Test Plan

Ran phd stop --force in production, saw daemons get killed instead of the process itself.

Diff Detail

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

Event Timeline

epriestley retitled this revision from to Make parsing of daemon PIDs more robust.
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 17 2015, 7:40 PM
This revision was automatically updated to reflect the committed changes.