[ 
https://issues.apache.org/jira/browse/HIVE-21730?focusedWorklogId=243189&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-243189
 ]

ASF GitHub Bot logged work on HIVE-21730:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/May/19 08:51
            Start Date: 16/May/19 08:51
    Worklog Time Spent: 10m 
      Work Description: sankarh commented on pull request #629: HIVE-21730: 
HiveStatement.getQueryId throws TProtocolException when response is null.
URL: https://github.com/apache/hive/pull/629#discussion_r284602959
 
 

 ##########
 File path: jdbc/src/java/org/apache/hive/jdbc/HiveStatement.java
 ##########
 @@ -1015,12 +1016,18 @@ public void setInPlaceUpdateStream(InPlaceUpdateStream 
stream) {
    */
   @LimitedPrivate(value={"Hive and closely related projects."})
   public String getQueryId() throws SQLException {
-    if (stmtHandle == null) {
+    // Storing it in temp variable as this method is not thread-safe and 
concurrent thread can
+    // close this handle and set it to null after checking for null.
+    TOperationHandle stmtHandleTmp = stmtHandle;
+    if (stmtHandleTmp == null) {
       // If query is not running or already closed.
       return null;
     }
     try {
-      return client.GetQueryId(new TGetQueryIdReq(stmtHandle)).getQueryId();
+      String queryId = client.GetQueryId(new 
TGetQueryIdReq(stmtHandleTmp)).getQueryId();
+
+      // Returns empty string if query was already closed.
 
 Review comment:
   fixed.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 243189)
    Time Spent: 40m  (was: 0.5h)

> HiveStatement.getQueryId throws TProtocolException when response is null.
> -------------------------------------------------------------------------
>
>                 Key: HIVE-21730
>                 URL: https://issues.apache.org/jira/browse/HIVE-21730
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 4.0.0
>            Reporter: Sankar Hariappan
>            Assignee: Sankar Hariappan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.0.0
>
>         Attachments: HIVE-21730.01.patch, HIVE-21730.02.patch
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> HiveStatement.getQueryId is failing with below exception if query is closed 
> concurrently.
> {code}
> 24256 2019-05-14T02:09:01,355  INFO [HiveServer2-Background-Pool: 
> Thread-1829] ql.Driver: Executing 
> command(queryId=hive_20190514020858_530a33d9-0b19-4f72-ae08-b631fb4749cb): 
> create table household_demographics
>  24257 stored as orc as
>  24258 select * from household_demographics_txt
>  24259 2019-05-14T02:09:01,356  INFO [HiveServer2-Background-Pool: 
> Thread-1829] hooks.HiveProtoLoggingHook: Received pre-hook notification for: 
> hive_20190514020858_530a33d9-0b19-4f72-ae08-b631fb4749cb
>  24260 2019-05-14T02:09:01,356 ERROR [HiveServer2-Handler-Pool: Thread-131] 
> server.TThreadPoolServer: Thrift error occurred during processing of message.
>  24261 org.apache.thrift.protocol.TProtocolException: Required field 
> 'queryId' is unset! Struct:TGetQueryIdResp(queryId:null)
>                                                                               
>                                                                               
>                                                                 24216,1       
> 10%
>  24260 2019-05-14T02:09:01,356 ERROR [HiveServer2-Handler-Pool: Thread-131] 
> server.TThreadPoolServer: Thrift error occurred during processing of message.
>  24261 org.apache.thrift.protocol.TProtocolException: Required field 
> 'queryId' is unset! Struct:TGetQueryIdResp(queryId:null)
>  24262         at 
> org.apache.hive.service.rpc.thrift.TGetQueryIdResp.validate(TGetQueryIdResp.java:294)
>  ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24263         at 
> org.apache.hive.service.rpc.thrift.TCLIService$GetQueryId_result.validate(TCLIService.java:18890)
>  ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24264         at 
> org.apache.hive.service.rpc.thrift.TCLIService$GetQueryId_result$GetQueryId_resultStandardScheme.write(TCLIService.java:18947)
>  ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24265         at 
> org.apache.hive.service.rpc.thrift.TCLIService$GetQueryId_result$GetQueryId_resultStandardScheme.write(TCLIService.java:18916)
>  ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24266         at 
> org.apache.hive.service.rpc.thrift.TCLIService$GetQueryId_result.write(TCLIService.java:18867)
>  ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24267         at 
> org.apache.thrift.ProcessFunction.process(ProcessFunction.java:53) 
> ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24268         at 
> org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39) 
> ~[hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24269         at 
> org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)
>  ~[hive-service-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24270         at 
> org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
>  [hive-exec-2.1.0.2.6.5.1150-19.jar:2.1.0.2.6.5.1150-19]
>  24271         at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  [?:1.8.0_161]
>  24272         at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  [?:1.8.0_161]
>  24273         at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to