hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077691 - in /hadoop/common/branches/branch-0.20-security-patches/src: mapred/org/apache/hadoop/mapred/JvmManager.java test/org/apache/hadoop/mapred/TestKillSubProcesses.java
Date Fri, 04 Mar 2011 04:44:59 GMT
Author: omalley
Date: Fri Mar  4 04:44:59 2011
New Revision: 1077691

URL: http://svn.apache.org/viewvc?rev=1077691&view=rev
Log:
commit 70a8b3346d30e365f4a95611a4d8604148b31170
Author: Chris Douglas <cdouglas@apache.org>
Date:   Fri Sep 17 20:09:38 2010 -0700

    Send SIGTERM before SIGKILL

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JvmManager.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java

Modified: hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JvmManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JvmManager.java?rev=1077691&r1=1077690&r2=1077691&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JvmManager.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/mapred/org/apache/hadoop/mapred/JvmManager.java
Fri Mar  4 04:44:59 2011
@@ -218,7 +218,7 @@ class JvmManager {
     private final long sleeptimeBeforeSigkill;
     
     Random rand = new Random(System.currentTimeMillis());
-    private static final String DELAY_BEFORE_KILL_KEY =
+    static final String DELAY_BEFORE_KILL_KEY =
       "mapred.tasktracker.tasks.sleeptime-before-sigkill";
     // number of milliseconds to wait between TERM and KILL.
     private static final long DEFAULT_SLEEPTIME_BEFORE_SIGKILL = 250;
@@ -540,9 +540,13 @@ class JvmManager {
             String user = env.conf.getUser();
             int pid = Integer.parseInt(pidStr);
             // start a thread that will kill the process dead
-            //new DelayedProcessKiller(user, pid, sleeptimeBeforeSigkill, 
-            //                         Signal.KILL).start();
-            controller.signalTask(user, pid, Signal.KILL);
+            if (sleeptimeBeforeSigkill > 0) {
+              new DelayedProcessKiller(user, pid, sleeptimeBeforeSigkill, 
+                                       Signal.KILL).start();
+              controller.signalTask(user, pid, Signal.TERM);
+            } else {
+              controller.signalTask(user, pid, Signal.KILL);
+            }
           } else {
             LOG.info(String.format("JVM Not killed %s but just removed", jvmId
                 .toString()));

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java?rev=1077691&r1=1077690&r2=1077691&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
Fri Mar  4 04:44:59 2011
@@ -309,9 +309,10 @@ public class TestKillSubProcesses extend
       return;
     }
     
-    JobConf conf=null;
     try {
-      mr = new MiniMRCluster(1, "file:///", 1);
+      JobConf conf = new JobConf();
+      conf.setLong(JvmManager.JvmManagerForType.DELAY_BEFORE_KILL_KEY, 0L);
+      mr = new MiniMRCluster(1, "file:///", 1, null, null, conf);
 
       // run the TCs
       conf = mr.createJobConf();



Mime
View raw message