-
Notifications
You must be signed in to change notification settings - Fork 107
Move warning about too many pids to error path #834
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,42 +258,45 @@ function safe_kill() { | |
| # should not happen | ||
| return 1 | ||
| fi | ||
|
|
||
| # check that the pid corresponds to the tool | ||
| pidlist=$(pidof -x $tool) | ||
| typeset -i len=0 | ||
| for p in $pidlist ;do | ||
| len=$len+1 | ||
| if [[ $p == $pid ]] ;then | ||
| pid_to_kill=$pid | ||
| fi | ||
| done | ||
| # hack: individual tools will have a different number of pids running. | ||
| # we might just delete the warning if it gets too cumbersome. | ||
| if [[ $len > 4 || ($len > 3 && $tool != "turbostat") ]] ;then | ||
| warn_log "Too many pids for $tool: $pidlist -- maybe old tools running? Use pbench-kill-tools." | ||
| fi | ||
|
|
||
|
|
||
| rc=0 | ||
| if [ ! -z "$pid_to_kill" ] ;then | ||
| kill -s $signal $pid_to_kill 2>/dev/null | ||
| rc=$? | ||
| fi | ||
|
|
||
| [[ $rc == 0 ]] && return 0 | ||
|
|
||
| # check if the process is still running. | ||
| pid_to_kill="" | ||
| typeset -i len=0 | ||
| pidlist=$(pidof -x $tool) | ||
| for p in $pidlist ;do | ||
| len=$len+1 | ||
| if [[ $p == $pid ]] ;then | ||
| # why is the pid still there? | ||
| kill -s KILL $pid 2>/dev/null | ||
| return 2 | ||
| pid_to_kill=$pid | ||
| # else | ||
| # why are there other tool processes running? | ||
| # should we kill them? | ||
| fi | ||
| done | ||
|
|
||
| if [ ! -z "$pid_to_kill" ] ;then | ||
| kill -s KILL $pid_to_kill 2>/dev/null | ||
| return 2 | ||
| fi | ||
|
|
||
| if [[ $len > 4 || ($len > 3 && $tool != "turbostat") ]] ;then | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a comment here that explain why there is a special case for turbostat?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes there should be. Does anybody know the history of that check?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry - I don't remember. I'll try to instrument safer_kill and see why turbostat seems to behave differently from everything else.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I get 3 pids from
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, can we track this as a separate piece of work in issue #887, and not make further changes here, since this PR did not change that behavior?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| warn_log "Too many pids for $tool: $pidlist -- maybe old tools running? Use pbench-kill-tools." | ||
| fi | ||
| return 0 | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add an explanation of why there are other processess running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we actually know, but we will emit a message on line 298 if we don't find a pid to kill.