[06/14] hive git commit: HIVE-11819 : HiveServer2 catches OOMs on request threads (Sergey Shelukhin, reviewed by Vaibhav Gumashta)

2015-09-30 Thread sershe
HIVE-11819 : HiveServer2 catches OOMs on request threads (Sergey Shelukhin, 
reviewed by Vaibhav Gumashta)


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

Branch: refs/heads/llap
Commit: 6a8d7e4cd55e5317aeb5a71005e5c98e09b22cc2
Parents: e1ce9a2
Author: Sergey Shelukhin 
Authored: Tue Sep 29 15:42:23 2015 -0700
Committer: Sergey Shelukhin 
Committed: Tue Sep 29 15:42:23 2015 -0700

--
 .../service/cli/session/HiveSessionProxy.java   |  6 +++
 .../thrift/EmbeddedThriftBinaryCLIService.java  |  2 +-
 .../thrift/ThreadPoolExecutorWithOomHook.java   | 55 
 .../cli/thrift/ThriftBinaryCLIService.java  | 12 +++--
 .../service/cli/thrift/ThriftCLIService.java|  3 ++
 .../cli/thrift/ThriftHttpCLIService.java| 10 ++--
 .../apache/hive/service/server/HiveServer2.java | 12 +++--
 .../hive/service/auth/TestPlainSaslHelper.java  |  2 +-
 .../session/TestPluggableHiveSessionImpl.java   |  2 +-
 .../cli/session/TestSessionGlobalInitFile.java  |  2 +-
 10 files changed, 90 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/6a8d7e4c/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java 
b/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
index 5b10521..433f14e 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
@@ -79,6 +79,12 @@ public class HiveSessionProxy implements InvocationHandler {
 } catch (InvocationTargetException e) {
   if (e.getCause() instanceof HiveSQLException) {
 throw (HiveSQLException)e.getCause();
+  } else if (e.getCause() instanceof OutOfMemoryError) {
+throw (OutOfMemoryError)e.getCause();
+  } else if (e.getCause() instanceof Error) {
+// TODO: maybe we should throw this as-is too. ThriftCLIService 
currently catches Exception,
+//   so the combination determines what would kill the HS2 
executor thread. For now,
+//   let's only allow OOM to propagate.
   }
   throw new RuntimeException(e.getCause());
 } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/hive/blob/6a8d7e4c/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
 
b/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
index a57fc8f..e9a5830 100644
--- 
a/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
+++ 
b/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
@@ -30,7 +30,7 @@ import org.apache.hive.service.cli.ICLIService;
 public class EmbeddedThriftBinaryCLIService extends ThriftBinaryCLIService {
 
   public EmbeddedThriftBinaryCLIService() {
-super(new CLIService(null));
+super(new CLIService(null), null);
 isEmbedded = true;
 HiveConf.setLoadHiveServer2Config(true);
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/6a8d7e4c/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
 
b/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
new file mode 100644
index 000..51731ad
--- /dev/null
+++ 
b/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific langua

hive git commit: HIVE-11819 : HiveServer2 catches OOMs on request threads (Sergey Shelukhin, reviewed by Vaibhav Gumashta)

2015-09-29 Thread sershe
Repository: hive
Updated Branches:
  refs/heads/master e1ce9a23a -> 6a8d7e4cd


HIVE-11819 : HiveServer2 catches OOMs on request threads (Sergey Shelukhin, 
reviewed by Vaibhav Gumashta)


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

Branch: refs/heads/master
Commit: 6a8d7e4cd55e5317aeb5a71005e5c98e09b22cc2
Parents: e1ce9a2
Author: Sergey Shelukhin 
Authored: Tue Sep 29 15:42:23 2015 -0700
Committer: Sergey Shelukhin 
Committed: Tue Sep 29 15:42:23 2015 -0700

--
 .../service/cli/session/HiveSessionProxy.java   |  6 +++
 .../thrift/EmbeddedThriftBinaryCLIService.java  |  2 +-
 .../thrift/ThreadPoolExecutorWithOomHook.java   | 55 
 .../cli/thrift/ThriftBinaryCLIService.java  | 12 +++--
 .../service/cli/thrift/ThriftCLIService.java|  3 ++
 .../cli/thrift/ThriftHttpCLIService.java| 10 ++--
 .../apache/hive/service/server/HiveServer2.java | 12 +++--
 .../hive/service/auth/TestPlainSaslHelper.java  |  2 +-
 .../session/TestPluggableHiveSessionImpl.java   |  2 +-
 .../cli/session/TestSessionGlobalInitFile.java  |  2 +-
 10 files changed, 90 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hive/blob/6a8d7e4c/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java 
b/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
index 5b10521..433f14e 100644
--- a/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
+++ b/service/src/java/org/apache/hive/service/cli/session/HiveSessionProxy.java
@@ -79,6 +79,12 @@ public class HiveSessionProxy implements InvocationHandler {
 } catch (InvocationTargetException e) {
   if (e.getCause() instanceof HiveSQLException) {
 throw (HiveSQLException)e.getCause();
+  } else if (e.getCause() instanceof OutOfMemoryError) {
+throw (OutOfMemoryError)e.getCause();
+  } else if (e.getCause() instanceof Error) {
+// TODO: maybe we should throw this as-is too. ThriftCLIService 
currently catches Exception,
+//   so the combination determines what would kill the HS2 
executor thread. For now,
+//   let's only allow OOM to propagate.
   }
   throw new RuntimeException(e.getCause());
 } catch (IllegalArgumentException e) {

http://git-wip-us.apache.org/repos/asf/hive/blob/6a8d7e4c/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
 
b/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
index a57fc8f..e9a5830 100644
--- 
a/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
+++ 
b/service/src/java/org/apache/hive/service/cli/thrift/EmbeddedThriftBinaryCLIService.java
@@ -30,7 +30,7 @@ import org.apache.hive.service.cli.ICLIService;
 public class EmbeddedThriftBinaryCLIService extends ThriftBinaryCLIService {
 
   public EmbeddedThriftBinaryCLIService() {
-super(new CLIService(null));
+super(new CLIService(null), null);
 isEmbedded = true;
 HiveConf.setLoadHiveServer2Config(true);
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/6a8d7e4c/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
--
diff --git 
a/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
 
b/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
new file mode 100644
index 000..51731ad
--- /dev/null
+++ 
b/service/src/java/org/apache/hive/service/cli/thrift/ThreadPoolExecutorWithOomHook.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS O