You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2012/04/23 23:25:50 UTC

svn commit: r1329461 - /hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java

Author: hashutosh
Date: Mon Apr 23 21:25:50 2012
New Revision: 1329461

URL: http://svn.apache.org/viewvc?rev=1329461&view=rev
Log:
HIVE-2883 [jira] Metastore client doesnt close connection properly

Summary:
https://issues.apache.org/jira/browse/HIVE-2883

Here is the patch which gets rid of this problem as per my hypothesis. I also
tested it and the above noted stack trace doesnt occur anymore.

While closing connection, it always fail with following trace. Seemingly, it
doesnt have any harmful effects.

12/03/20 10:55:02 ERROR hive.metastore: Unable to shutdown local metastore
client
org.apache.thrift.transport.TTransportException: Cannot write to null
outputStream
	at
org.apache.thrift.transport.TIOStreamTransport.write(TIOStreamTransport.java:142)
	at
org.apache.thrift.protocol.TBinaryProtocol.writeI32(TBinaryProtocol.java:163)
	at
org.apache.thrift.protocol.TBinaryProtocol.writeMessageBegin(TBinaryProtocol.java:91)
	at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:62)
	at
com.facebook.fb303.FacebookService$Client.send_shutdown(FacebookService.java:421)
	at com.facebook.fb303.FacebookService$Client.shutdown(FacebookService.java:415)
	at
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.close(HiveMetaStoreClient.java:310)

Test Plan: EMPTY

Reviewers: JIRA, cwsteinbach

Reviewed By: cwsteinbach

Differential Revision: https://reviews.facebook.net/D2613

Modified:
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java?rev=1329461&r1=1329460&r2=1329461&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java Mon Apr 23 21:25:50 2012
@@ -307,9 +307,6 @@ public class HiveMetaStoreClient impleme
 
   public void close() {
     isConnected = false;
-    if ((transport != null) && transport.isOpen()) {
-      transport.close();
-    }
     try {
       if (null != client) {
         client.shutdown();
@@ -317,6 +314,11 @@ public class HiveMetaStoreClient impleme
     } catch (TException e) {
       LOG.error("Unable to shutdown local metastore client", e);
     }
+    // Transport would have got closed via client.shutdown(), so we dont need this, but
+    // just in case, we make this call.
+    if ((transport != null) && transport.isOpen()) {
+      transport.close();
+    }
   }
 
   /**