hadoop git commit: HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures. Contributed by Steve Loughran

2017-09-28 Thread wang
Repository: hadoop
Updated Branches:
  refs/heads/branch-3.0 46031d84f -> 2223393ad


HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures.  
Contributed by Steve Loughran

(cherry picked from commit 180e814b081d3707c95641171d649b547db41a04)


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

Branch: refs/heads/branch-3.0
Commit: 2223393ad1d5ffdd62da79e1546de79c6259dc12
Parents: 46031d8
Author: Aaron Fabbri 
Authored: Fri Sep 8 19:26:27 2017 -0700
Committer: Andrew Wang 
Committed: Thu Sep 28 10:25:17 2017 -0700

--
 .../org/apache/hadoop/test/LambdaTestUtils.java |  68 +++---
 .../apache/hadoop/test/TestLambdaTestUtils.java | 127 +--
 2 files changed, 163 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/2223393a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
index 00cfa44..3ea9ab8 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
@@ -70,7 +70,7 @@ public final class LambdaTestUtils {
  * @throws Exception if the handler wishes to raise an exception
  * that way.
  */
-Exception evaluate(int timeoutMillis, Exception caught) throws Exception;
+Throwable evaluate(int timeoutMillis, Throwable caught) throws Throwable;
   }
 
   /**
@@ -116,7 +116,7 @@ public final class LambdaTestUtils {
 Preconditions.checkNotNull(timeoutHandler);
 
 long endTime = Time.now() + timeoutMillis;
-Exception ex = null;
+Throwable ex = null;
 boolean running = true;
 int iterations = 0;
 while (running) {
@@ -128,9 +128,11 @@ public final class LambdaTestUtils {
 // the probe failed but did not raise an exception. Reset any
 // exception raised by a previous probe failure.
 ex = null;
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 throw e;
-  } catch (Exception e) {
+  } catch (Throwable e) {
 LOG.debug("eventually() iteration {}", iterations, e);
 ex = e;
   }
@@ -145,15 +147,20 @@ public final class LambdaTestUtils {
   }
 }
 // timeout
-Exception evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
-if (evaluate == null) {
-  // bad timeout handler logic; fall back to GenerateTimeout so the
-  // underlying problem isn't lost.
-  LOG.error("timeout handler {} did not throw an exception ",
-  timeoutHandler);
-  evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+Throwable evaluate;
+try {
+  evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
+  if (evaluate == null) {
+// bad timeout handler logic; fall back to GenerateTimeout so the
+// underlying problem isn't lost.
+LOG.error("timeout handler {} did not throw an exception ",
+timeoutHandler);
+evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+  }
+} catch (Throwable throwable) {
+  evaluate = throwable;
 }
-throw evaluate;
+return raise(evaluate);
   }
 
   /**
@@ -217,6 +224,7 @@ public final class LambdaTestUtils {
* @throws Exception the last exception thrown before timeout was triggered
* @throws FailFastException if raised -without any retry attempt.
* @throws InterruptedException if interrupted during the sleep operation.
+   * @throws OutOfMemoryError you've run out of memory.
*/
   public static  T eventually(int timeoutMillis,
   Callable eval,
@@ -224,7 +232,7 @@ public final class LambdaTestUtils {
 Preconditions.checkArgument(timeoutMillis >= 0,
 "timeoutMillis must be >= 0");
 long endTime = Time.now() + timeoutMillis;
-Exception ex;
+Throwable ex;
 boolean running;
 int sleeptime;
 int iterations = 0;
@@ -232,10 +240,12 @@ public final class LambdaTestUtils {
   iterations++;
   try {
 return eval.call();
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
  

hadoop git commit: HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures. Contributed by Steve Loughran

2017-09-11 Thread stevel
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 b669aca51 -> a46204437


HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures.
Contributed by Steve Loughran

(cherry picked from commit 180e814b081d3707c95641171d649b547db41a04)


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

Branch: refs/heads/branch-2
Commit: a46204437b1c4929788ce4a9b3a5fb7040d7b01d
Parents: b669aca
Author: Steve Loughran 
Authored: Mon Sep 11 21:33:11 2017 +0100
Committer: Steve Loughran 
Committed: Mon Sep 11 21:33:44 2017 +0100

--
 .../org/apache/hadoop/test/LambdaTestUtils.java | 67 ++--
 .../apache/hadoop/test/TestLambdaTestUtils.java |  2 +-
 2 files changed, 49 insertions(+), 20 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/a4620443/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
index 1fa5c3f..f5be132 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
@@ -70,7 +70,7 @@ public final class LambdaTestUtils {
  * @throws Exception if the handler wishes to raise an exception
  * that way.
  */
-Exception evaluate(int timeoutMillis, Exception caught) throws Exception;
+Throwable evaluate(int timeoutMillis, Throwable caught) throws Throwable;
   }
 
   /**
@@ -116,7 +116,7 @@ public final class LambdaTestUtils {
 Preconditions.checkNotNull(timeoutHandler);
 
 long endTime = Time.now() + timeoutMillis;
-Exception ex = null;
+Throwable ex = null;
 boolean running = true;
 int iterations = 0;
 while (running) {
@@ -128,9 +128,11 @@ public final class LambdaTestUtils {
 // the probe failed but did not raise an exception. Reset any
 // exception raised by a previous probe failure.
 ex = null;
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 throw e;
-  } catch (Exception e) {
+  } catch (Throwable e) {
 LOG.debug("eventually() iteration {}", iterations, e);
 ex = e;
   }
@@ -145,15 +147,20 @@ public final class LambdaTestUtils {
   }
 }
 // timeout
-Exception evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
-if (evaluate == null) {
-  // bad timeout handler logic; fall back to GenerateTimeout so the
-  // underlying problem isn't lost.
-  LOG.error("timeout handler {} did not throw an exception ",
-  timeoutHandler);
-  evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+Throwable evaluate;
+try {
+  evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
+  if (evaluate == null) {
+// bad timeout handler logic; fall back to GenerateTimeout so the
+// underlying problem isn't lost.
+LOG.error("timeout handler {} did not throw an exception ",
+timeoutHandler);
+evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+  }
+} catch (Throwable throwable) {
+  evaluate = throwable;
 }
-throw evaluate;
+return raise(evaluate);
   }
 
   /**
@@ -217,6 +224,7 @@ public final class LambdaTestUtils {
* @throws Exception the last exception thrown before timeout was triggered
* @throws FailFastException if raised -without any retry attempt.
* @throws InterruptedException if interrupted during the sleep operation.
+   * @throws OutOfMemoryError you've run out of memory.
*/
   public static  T eventually(int timeoutMillis,
   Callable eval,
@@ -224,7 +232,7 @@ public final class LambdaTestUtils {
 Preconditions.checkArgument(timeoutMillis >= 0,
 "timeoutMillis must be >= 0");
 long endTime = Time.now() + timeoutMillis;
-Exception ex;
+Throwable ex;
 boolean running;
 int sleeptime;
 int iterations = 0;
@@ -232,10 +240,12 @@ public final class LambdaTestUtils {
   iterations++;
   try {
 return eval.call();
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 // 

[44/50] [abbrv] hadoop git commit: HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures. Contributed by Steve Loughran

2017-09-11 Thread asuresh
HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures.  
Contributed by Steve Loughran


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

Branch: refs/heads/YARN-5972
Commit: 180e814b081d3707c95641171d649b547db41a04
Parents: 3fddabc
Author: Aaron Fabbri 
Authored: Fri Sep 8 19:26:27 2017 -0700
Committer: Aaron Fabbri 
Committed: Fri Sep 8 19:32:07 2017 -0700

--
 .../org/apache/hadoop/test/LambdaTestUtils.java |  68 +++---
 .../apache/hadoop/test/TestLambdaTestUtils.java | 127 +--
 2 files changed, 163 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/180e814b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
index 00cfa44..3ea9ab8 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
@@ -70,7 +70,7 @@ public final class LambdaTestUtils {
  * @throws Exception if the handler wishes to raise an exception
  * that way.
  */
-Exception evaluate(int timeoutMillis, Exception caught) throws Exception;
+Throwable evaluate(int timeoutMillis, Throwable caught) throws Throwable;
   }
 
   /**
@@ -116,7 +116,7 @@ public final class LambdaTestUtils {
 Preconditions.checkNotNull(timeoutHandler);
 
 long endTime = Time.now() + timeoutMillis;
-Exception ex = null;
+Throwable ex = null;
 boolean running = true;
 int iterations = 0;
 while (running) {
@@ -128,9 +128,11 @@ public final class LambdaTestUtils {
 // the probe failed but did not raise an exception. Reset any
 // exception raised by a previous probe failure.
 ex = null;
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 throw e;
-  } catch (Exception e) {
+  } catch (Throwable e) {
 LOG.debug("eventually() iteration {}", iterations, e);
 ex = e;
   }
@@ -145,15 +147,20 @@ public final class LambdaTestUtils {
   }
 }
 // timeout
-Exception evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
-if (evaluate == null) {
-  // bad timeout handler logic; fall back to GenerateTimeout so the
-  // underlying problem isn't lost.
-  LOG.error("timeout handler {} did not throw an exception ",
-  timeoutHandler);
-  evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+Throwable evaluate;
+try {
+  evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
+  if (evaluate == null) {
+// bad timeout handler logic; fall back to GenerateTimeout so the
+// underlying problem isn't lost.
+LOG.error("timeout handler {} did not throw an exception ",
+timeoutHandler);
+evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+  }
+} catch (Throwable throwable) {
+  evaluate = throwable;
 }
-throw evaluate;
+return raise(evaluate);
   }
 
   /**
@@ -217,6 +224,7 @@ public final class LambdaTestUtils {
* @throws Exception the last exception thrown before timeout was triggered
* @throws FailFastException if raised -without any retry attempt.
* @throws InterruptedException if interrupted during the sleep operation.
+   * @throws OutOfMemoryError you've run out of memory.
*/
   public static  T eventually(int timeoutMillis,
   Callable eval,
@@ -224,7 +232,7 @@ public final class LambdaTestUtils {
 Preconditions.checkArgument(timeoutMillis >= 0,
 "timeoutMillis must be >= 0");
 long endTime = Time.now() + timeoutMillis;
-Exception ex;
+Throwable ex;
 boolean running;
 int sleeptime;
 int iterations = 0;
@@ -232,10 +240,12 @@ public final class LambdaTestUtils {
   iterations++;
   try {
 return eval.call();
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 // these two exceptions trigger an immediate exit
 throw e;
-  } catch (Exception e) {
+  } catch (Throwable e) {
 

hadoop git commit: HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures. Contributed by Steve Loughran

2017-09-08 Thread fabbri
Repository: hadoop
Updated Branches:
  refs/heads/trunk 3fddabc2f -> 180e814b0


HADOOP-14851 LambdaTestUtils.eventually() doesn't spin on Assertion failures.  
Contributed by Steve Loughran


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

Branch: refs/heads/trunk
Commit: 180e814b081d3707c95641171d649b547db41a04
Parents: 3fddabc
Author: Aaron Fabbri 
Authored: Fri Sep 8 19:26:27 2017 -0700
Committer: Aaron Fabbri 
Committed: Fri Sep 8 19:32:07 2017 -0700

--
 .../org/apache/hadoop/test/LambdaTestUtils.java |  68 +++---
 .../apache/hadoop/test/TestLambdaTestUtils.java | 127 +--
 2 files changed, 163 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/180e814b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
--
diff --git 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
index 00cfa44..3ea9ab8 100644
--- 
a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
+++ 
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
@@ -70,7 +70,7 @@ public final class LambdaTestUtils {
  * @throws Exception if the handler wishes to raise an exception
  * that way.
  */
-Exception evaluate(int timeoutMillis, Exception caught) throws Exception;
+Throwable evaluate(int timeoutMillis, Throwable caught) throws Throwable;
   }
 
   /**
@@ -116,7 +116,7 @@ public final class LambdaTestUtils {
 Preconditions.checkNotNull(timeoutHandler);
 
 long endTime = Time.now() + timeoutMillis;
-Exception ex = null;
+Throwable ex = null;
 boolean running = true;
 int iterations = 0;
 while (running) {
@@ -128,9 +128,11 @@ public final class LambdaTestUtils {
 // the probe failed but did not raise an exception. Reset any
 // exception raised by a previous probe failure.
 ex = null;
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 throw e;
-  } catch (Exception e) {
+  } catch (Throwable e) {
 LOG.debug("eventually() iteration {}", iterations, e);
 ex = e;
   }
@@ -145,15 +147,20 @@ public final class LambdaTestUtils {
   }
 }
 // timeout
-Exception evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
-if (evaluate == null) {
-  // bad timeout handler logic; fall back to GenerateTimeout so the
-  // underlying problem isn't lost.
-  LOG.error("timeout handler {} did not throw an exception ",
-  timeoutHandler);
-  evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+Throwable evaluate;
+try {
+  evaluate = timeoutHandler.evaluate(timeoutMillis, ex);
+  if (evaluate == null) {
+// bad timeout handler logic; fall back to GenerateTimeout so the
+// underlying problem isn't lost.
+LOG.error("timeout handler {} did not throw an exception ",
+timeoutHandler);
+evaluate = new GenerateTimeout().evaluate(timeoutMillis, ex);
+  }
+} catch (Throwable throwable) {
+  evaluate = throwable;
 }
-throw evaluate;
+return raise(evaluate);
   }
 
   /**
@@ -217,6 +224,7 @@ public final class LambdaTestUtils {
* @throws Exception the last exception thrown before timeout was triggered
* @throws FailFastException if raised -without any retry attempt.
* @throws InterruptedException if interrupted during the sleep operation.
+   * @throws OutOfMemoryError you've run out of memory.
*/
   public static  T eventually(int timeoutMillis,
   Callable eval,
@@ -224,7 +232,7 @@ public final class LambdaTestUtils {
 Preconditions.checkArgument(timeoutMillis >= 0,
 "timeoutMillis must be >= 0");
 long endTime = Time.now() + timeoutMillis;
-Exception ex;
+Throwable ex;
 boolean running;
 int sleeptime;
 int iterations = 0;
@@ -232,10 +240,12 @@ public final class LambdaTestUtils {
   iterations++;
   try {
 return eval.call();
-  } catch (InterruptedException | FailFastException e) {
+  } catch (InterruptedException
+  | FailFastException
+  | VirtualMachineError e) {
 // these two exceptions trigger an immediate exit
 throw e;
-