hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szege...@apache.org
Subject hadoop git commit: HADOOP-14855. Hadoop scripts may errantly believe a daemon is still running, preventing it from starting. Contributed by Robert Kanter.
Date Wed, 04 Apr 2018 22:36:46 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 345e7624d -> e52539b46


HADOOP-14855. Hadoop scripts may errantly believe a daemon is still running, preventing it
from starting. Contributed by Robert Kanter.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e52539b4
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e52539b4
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e52539b4

Branch: refs/heads/trunk
Commit: e52539b46fb13db423490fe02d46e9fae72d72fe
Parents: 345e762
Author: Miklos Szegedi <szegedim@apache.org>
Authored: Wed Apr 4 15:35:58 2018 -0700
Committer: Miklos Szegedi <szegedim@apache.org>
Committed: Wed Apr 4 15:35:58 2018 -0700

----------------------------------------------------------------------
 .../hadoop-common/src/main/bin/hadoop-functions.sh          | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e52539b4/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
index 9ea4587..9ef48b6 100755
--- a/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
+++ b/hadoop-common-project/hadoop-common/src/main/bin/hadoop-functions.sh
@@ -1725,11 +1725,16 @@ function hadoop_status_daemon
   shift
 
   local pid
+  local pspid
 
   if [[ -f "${pidfile}" ]]; then
     pid=$(cat "${pidfile}")
-    if ps -p "${pid}" > /dev/null 2>&1; then
-      return 0
+    if pspid=$(ps -o args= -p"${pid}" 2>/dev/null); then
+      # this is to check that the running process we found is actually the same
+      # daemon that we're interested in
+      if [[ ${pspid} =~ -Dproc_${daemonname} ]]; then
+        return 0
+      fi
     fi
     return 1
   fi


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message