[
https://issues.apache.org/jira/browse/AMBARI-19768?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15861306#comment-15861306
]
Hudson commented on AMBARI-19768:
---------------------------------
FAILURE: Integrated in Jenkins build Ambari-trunk-Commit #6700 (See
[https://builds.apache.org/job/Ambari-trunk-Commit/6700/])
AMBARI-19768. Broken kill_process_with_children shell single liner
(dlysnichenko:
[http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=41034aa157cc7b36f1635064055b83deb5f542bc])
* (edit) ambari-agent/src/test/python/ambari_agent/TestShell.py
* (add) ambari-agent/src/test/python/ambari_agent/TestProcessUtils.py
* (add) ambari-common/src/main/python/ambari_commons/process_utils.py
* (edit) ambari-common/src/main/python/ambari_commons/shell.py
> Broken kill_process_with_children shell single liner
> -----------------------------------------------------
>
> Key: AMBARI-19768
> URL: https://issues.apache.org/jira/browse/AMBARI-19768
> Project: Ambari
> Issue Type: Bug
> Components: ambari-server
> Affects Versions: 2.5.0
> Reporter: Dmitry Lysnichenko
> Assignee: Dmitry Lysnichenko
> Priority: Critical
> Fix For: 2.5.0
>
> Attachments: AMBARI-19768.1.patch, AMBARI-19768.2.patch,
> AMBARI-19768.patch
>
>
> This single liner does not work correctly in some cases
> {code} CMD = """ps xf | awk -v PID=""" + str(pid) + \
> """ ' $1 == PID { P = $1; next } P && /_/ { P = P " " $1;""" + \
> """K=P } P && !/_/ { P="" } END { print "kill -""" \
> + str(signal) + """ "K }' | sh """{code}
> *Example*
> {code}((sleep 3141592) & ((sleep 3141592) & (sleep 3141592))
> ps xf
> 3231 ? Ss 0:01 \_ sshd: root@pts/0
> 3233 pts/0 Ss 0:00 | \_ -bash
> 17984 pts/0 S+ 0:00 | \_ -bash
> 17985 pts/0 S+ 0:00 | \_ sleep 3141592
> 17986 pts/0 S+ 0:00 | \_ -bash
> 17987 pts/0 S+ 0:00 | \_ sleep 3141592
> 17988 pts/0 S+ 0:00 | \_ sleep 3141592
> 17738 ? Ss 0:00 \_ sshd: root@pts/1
> 17740 pts/1 Ss 0:00 \_ -bash
> 17989 pts/1 R+ 0:00 \_ ps xf
> ps xf | awk -v PID=17987 ' $1 == PID { P = $1; next } P && /_/ { P = P " "
> $1;K=P } P && !/_/ { P="" } END { print "kill "K }'
> (PID=17987)
> result : "kill 17987 17988 17738 17740 18083 18084"
> but right will only "kill 17987"
> (PID=17985)
> result : "kill 17985 17986 17987 17988 17738 17740 18697 18698"
> right : "kill 17985"
> (PID=17986)
> result : "kill 17986 17987 17988 17738 17740 18980 18981"
> right : "kill 17986 17987 17988"
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)