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)
Sat, May 4, 6:47 PM
Unknown Object (File)
Thu, May 2, 8:58 AM
Unknown Object (File)
Wed, May 1, 3:11 AM
Unknown Object (File)
Wed, May 1, 12:09 AM
Unknown Object (File)
Sat, Apr 20, 10:01 PM
Unknown Object (File)
Thu, Apr 11, 9:04 AM
Unknown Object (File)
Apr 6 2024, 11:21 AM
Unknown Object (File)
Apr 2 2024, 10:36 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.