zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mina...@apache.org
Subject zeppelin git commit: [ZEPPELIN-1128] add try-catch in close() method.
Date Fri, 22 Jul 2016 07:03:42 GMT
Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.6 5feb6b2fc -> 73d3cf742


[ZEPPELIN-1128] add try-catch in close() method.

### What is this PR for?
Fix bug on JdbcInterpreter when hive server restarted.
each connection.close() should be wraped by try-catch.

### What type of PR is it?
Bug Fix

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1128

### How should this be tested?
Restart hive while zeppelin still alive.

After that, Zeppelin notebook's hive query execution will be fail
![error](https://cloud.githubusercontent.com/assets/366810/16649904/3071ec56-4476-11e6-9d13-75d4fa0f8f4f.PNG)

Stacktrace is like this.
It was HiveInterpreter because i use zeppelin by yum install on centos(some old version).
But JdbcInterpreter & HiveInterpreter's close() method is same.

> ERROR [2016-07-07 18:23:46,676] ({pool-1-thread-2} HiveInterpreter.java[close]:166) -
Error while closing...
java.sql.SQLException: Error while cleaning up the server resources
        at org.apache.hive.jdbc.HiveConnection.close(HiveConnection.java:721)
        at org.apache.zeppelin.hive.HiveInterpreter.close(HiveInterpreter.java:151)
        at org.apache.zeppelin.interpreter.ClassloaderInterpreter.close(ClassloaderInterpreter.java:88)
        at org.apache.zeppelin.interpreter.LazyOpenInterpreter.close(LazyOpenInterpreter.java:78)
        at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer.close(RemoteInterpreterServer.java:232)
        at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Processor$close.getResult(RemoteInterpreterService.java:1432)
        at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Processor$close.getResult(RemoteInterpreterService.java:1417)
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
        at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:285)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.thrift.transport.TTransportException: java.net.SocketException: Broken
pipe
        at org.apache.thrift.transport.TIOStreamTransport.flush(TIOStreamTransport.java:161)
        at org.apache.thrift.transport.TSaslTransport.flush(TSaslTransport.java:501)
        at org.apache.thrift.transport.TSaslClientTransport.flush(TSaslClientTransport.java:37)
        at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:65)
        at org.apache.hive.service.cli.thrift.TCLIService$Client.send_CloseSession(TCLIService.java:177)
        at org.apache.hive.service.cli.thrift.TCLIService$Client.CloseSession(TCLIService.java:169)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.apache.hive.jdbc.HiveConnection$SynchronizedHandler.invoke(HiveConnection.java:1380)
        at com.sun.proxy.$Proxy0.CloseSession(Unknown Source)
        at org.apache.hive.jdbc.HiveConnection.close(HiveConnection.java:719)
        ... 12 more
Caused by: java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
        at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
        at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
        at org.apache.thrift.transport.TIOStreamTransport.flush(TIOStreamTransport.java:159)
        ... 24 more

### Screenshots (if appropriate)
![error](https://cloud.githubusercontent.com/assets/366810/16649904/3071ec56-4476-11e6-9d13-75d4fa0f8f4f.PNG)

Author: SungjuKwon <sungju.kwon@campmobile.com>

Closes #1144 from voyageth/patch-2 and squashes the following commits:

6a48291 [SungjuKwon] change catch SQLException to Excetion
7fbef4c [SungjuKwon] remove blank lines
857889b [SungjuKwon] fix build error
b3d0ef6 [SungjuKwon] add try-catch in close() method.

(cherry picked from commit 46bdddc004d451b7c069ca688d52bb1fdb7811ad)
Signed-off-by: Mina Lee <minalee@apache.org>


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

Branch: refs/heads/branch-0.6
Commit: 73d3cf742afdbf2cf338e67abd9ee43d27d81433
Parents: 5feb6b2
Author: SungjuKwon <sungju.kwon@campmobile.com>
Authored: Wed Jul 13 02:02:30 2016 +0900
Committer: Mina Lee <minalee@apache.org>
Committed: Fri Jul 22 16:03:38 2016 +0900

----------------------------------------------------------------------
 .../apache/zeppelin/jdbc/JDBCInterpreter.java   | 22 ++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/73d3cf74/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
----------------------------------------------------------------------
diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
index 34e91d7..83dda73 100644
--- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
+++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java
@@ -259,25 +259,35 @@ public class JDBCInterpreter extends Interpreter {
 
   @Override
   public void close() {
-
     try {
       for (List<Connection> connectionList : propertyKeyUnusedConnectionListMap.values())
{
         for (Connection c : connectionList) {
-          c.close();
+          try {
+            c.close();
+          } catch (Exception e) {
+            logger.error("Error while closing propertyKeyUnusedConnectionListMap connection...",
e);
+          }
         }
       }
 
       for (Statement statement : paragraphIdStatementMap.values()) {
-        statement.close();
+        try {
+          statement.close();
+        } catch (Exception e) {
+          logger.error("Error while closing paragraphIdStatementMap statement...", e);
+        }
       }
       paragraphIdStatementMap.clear();
 
       for (Connection connection : paragraphIdConnectionMap.values()) {
-        connection.close();
+        try {
+          connection.close();
+        } catch (Exception e) {
+          logger.error("Error while closing paragraphIdConnectionMap connection...", e);
+        }
       }
       paragraphIdConnectionMap.clear();
-
-    } catch (SQLException e) {
+    } catch (Exception e) {
       logger.error("Error while closing...", e);
     }
   }


Mime
View raw message