bookkeeper
bookkeeper copied to clipboard
Fix the pid occupied check when use bookkeeper-daemon.sh start or stop
Master Issue: #3112
Motivation
Fix the failed pid occupied check. we'll fail when use bookkeeper-daemon.sh start or stop bookie, after the last time we exit the bookie direct kill or the bookie occurred non-normal exit, then the bin/bookkeeper-bookie.pid are retained, and the pid in the file is occupied by the thread in other progress.
Changes
Change the pid occupied check from 'kill -0 $pid' to 'ps -p $pid'. The both will return true when the pid is occupied by one progress, but 'kill -0 $pid' will return true and the 'ps -p $pid' will return false when the pid is occupied by one progress's sub thread.
StackOverflow discussion: https://stackoverflow.com/questions/30958964/why-do-kill-0-pid-echo-and-ps-ppid-echo-sometimes-differ
on which platforms did you test this ? Did you test this on Linux and MacOS ?
Ci is not running for some reason @nicoloboschi do you have any ideas ?
perhaps: https://www.githubstatus.com/incidents/fpk08rxnqjz2
can you try to close and reopen the PR ?
on which platforms did you test this ? Did you test this on Linux and MacOS ?
@eolivelli I test the case in on Linux and MacOS. On Linux the 'kill -0 $pid' and 'ps -p $pid' performance diff as the discussion (https://stackoverflow.com/questions/30958964/why-do-kill-0-pid-echo-and-ps-ppid-echo-sometimes-differ);On MacOs, the both exhibit the same result;
fix old workflow,please see #3455 for detail
@Nicklee007 Could you please rebase the code? I will push on this forward. Thanks :)
@StevenLuMT Currently we don't have shell test suite, and it's difficult to built. So I think manual testing is enough
@StevenLuMT Currently we don't have shell test suite, and it's difficult to built. So I think manual testing is enough
ok,LGTM