bookkeeper icon indicating copy to clipboard operation
bookkeeper copied to clipboard

Fix the pid occupied check when use bookkeeper-daemon.sh start or stop

Open Nicklee007 opened this issue 2 years ago • 5 comments

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

Nicklee007 avatar Mar 16 '22 02:03 Nicklee007

on which platforms did you test this ? Did you test this on Linux and MacOS ?

eolivelli avatar Mar 17 '22 09:03 eolivelli

Ci is not running for some reason @nicoloboschi do you have any ideas ?

eolivelli avatar Mar 17 '22 09:03 eolivelli

perhaps: https://www.githubstatus.com/incidents/fpk08rxnqjz2

can you try to close and reopen the PR ?

nicoloboschi avatar Mar 17 '22 09:03 nicoloboschi

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;

Nicklee007 avatar Mar 18 '22 03:03 Nicklee007

fix old workflow,please see #3455 for detail

StevenLuMT avatar Aug 24 '22 08:08 StevenLuMT

@Nicklee007 Could you please rebase the code? I will push on this forward. Thanks :)

shoothzj avatar Apr 29 '24 00:04 shoothzj

@StevenLuMT Currently we don't have shell test suite, and it's difficult to built. So I think manual testing is enough

shoothzj avatar Apr 29 '24 07:04 shoothzj

@StevenLuMT Currently we don't have shell test suite, and it's difficult to built. So I think manual testing is enough

ok,LGTM

StevenLuMT avatar Apr 29 '24 07:04 StevenLuMT