[ 
https://issues.apache.org/jira/browse/HADOOP-13837?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15703836#comment-15703836
 ] 

Weiwei Yang commented on HADOOP-13837:
--------------------------------------

Hello [~aw]

Thanks for looking at this one. 
hadoop_status_daemon immediately returns if process exists or not based on the 
pid file, it cannot resolve the problem here. I am proposing to remove the 
fixed time sleep after kill

{code}
function hadoop_stop_daemon {
  ...
  kill "${pid}" >/dev/null 2>&1
  ## sleep for 5s after kill
  sleep "${HADOOP_STOP_TIMEOUT}"
}
{code}
you don't need to always wait for 5s (default) until that happens

and add a check after kill -9

{code}
function hadoop_stop_daemon {
  kill -9 "${pid}" >/dev/null 2>&1
  ...
  ## check result .. this needs to wait a moment
{code}

you need to wait a bit until kill -9 works. Plan to add a check something like 
{{hadoop_status_daemon_wrapper}}. Does that make sense?

> Process check bug in hadoop_stop_daemon of hadoop-functions.sh
> --------------------------------------------------------------
>
>                 Key: HADOOP-13837
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13837
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: scripts
>            Reporter: Weiwei Yang
>            Assignee: Weiwei Yang
>         Attachments: check_proc.sh
>
>
> Always get {{ERROR: Unable to kill ...}} after {{Trying to kill with kill 
> -9}}, see following output of stop-yarn.sh
> {code}
> <NM_HOST>: WARNING: nodemanager did not stop gracefully after 5 seconds: 
> Trying to kill with kill -9
> <NM_HOST>: ERROR: Unable to kill 18097
> {code}
> hadoop_stop_daemon doesn't check process liveness correctly, this bug can be 
> reproduced by the script easily. kill -9 would need some time to be done, 
> directly check process existence right after mostly will fail.
> {code}
> function hadoop_stop_daemon
> {
>     ...
>       kill -9 "${pid}" >/dev/null 2>&1
>     fi
>     if ps -p "${pid}" > /dev/null 2>&1; then
>       hadoop_error "ERROR: Unable to kill ${pid}"
>     else
>       ...
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to