Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agentctl.sh: Sanity check PID_FILE and remove at stop #278

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Feb 11, 2015

  1. agentctl.sh: Sanity check PID_FILE and remove at stop

    PID files are inherently problematic because PIDs are reused.  This
    means that at start up if we find a PID file and there is a running
    process with that PID we do nothing.  Unfortunately it is possible that
    our process long since died, PIDs have wrapped and are now getting
    reused and the process we found is an unrelated process.  The problem is
    even more likely at system start time if we find a PID file from the
    previous system boot.  In this case the system is starting up and
    spawning many new processes and it is likely that the low numbered PID
    we received on the previous boot will be near other processes starting
    in parallel.
    
    To help solve this problem we can remove stale PID files when we shut
    down cleanly.  Additionally we can perform a basic sanity check if we
    find a PID file and find the PID running to compare that they at least
    have the command we expect.  This commit performs both of these actions.
    
    Additionally PID files are typically written to /var/run or /run
    which get cleared on reboots.  I am not making that change since I do
    not know if there would be any ramifications to moving the location of
    the PID file.
    
    Signed-off-by: Shawn Bohrer <[email protected]>
    Shawn Bohrer committed Feb 11, 2015
    Configuration menu
    Copy the full SHA
    4459534 View commit details
    Browse the repository at this point in the history