Page MenuHomePhabricator

Make parsing of daemon PIDs more robust
ClosedPublic

Authored by epriestley on Feb 17 2015, 7:32 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Jan 21, 10:03 AM
Unknown Object (File)
Wed, Jan 15, 11:24 AM
Unknown Object (File)
Thu, Jan 2, 12:47 AM
Unknown Object (File)
Wed, Jan 1, 12:26 AM
Unknown Object (File)
Dec 17 2024, 6:30 AM
Unknown Object (File)
Dec 8 2024, 6:08 PM
Unknown Object (File)
Nov 24 2024, 3:28 AM
Unknown Object (File)
Nov 20 2024, 4:19 AM
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.