[ 
https://issues.apache.org/jira/browse/HIVE-14227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15394327#comment-15394327
 ] 

Mohit Sabharwal commented on HIVE-14227:
----------------------------------------

SessionHandle is getting passed in most (all?) calls to HS2: 
https://github.com/apache/hive/blob/master/service-rpc/if/TCLIService.thrift

In TThreadPoolServer 
(https://github.com/apache/thrift/blob/master/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java#L300)
the call order seems to be:

createContext -> processContext -> openSession (where we capture and set 
sessionHandle in the context as context.setSessionHandle(sessionHandle) -> 
deleteContext

Similarly, could we do for, say ExecuteStatement:

createContext -> processContext -> ExecuteStatement (where we capture and set 
sessionHandle like above) -> deleteContext

IOW, you can attach the session to any connection for every request 
individually. And keep a count of number of connections for every session which 
you decrement in deleteContext. When it reaches 0, you can delete the session.

Am I missing something ?

> Investigate invalid SessionHandle and invalid OperationHandle
> -------------------------------------------------------------
>
>                 Key: HIVE-14227
>                 URL: https://issues.apache.org/jira/browse/HIVE-14227
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 2.0.0
>            Reporter: Aihua Xu
>            Assignee: Aihua Xu
>         Attachments: HIVE-14227.1.patch
>
>
> There are the following warnings. 
> {noformat}
> WARN  org.apache.hive.service.cli.thrift.ThriftCLIService: 
> [HiveServer2-Handler-Pool: Thread-55]: Error executing statement:
> org.apache.hive.service.cli.HiveSQLException: Invalid SessionHandle: 
> SessionHandle [1bc00251-64e9-4a95-acb7-a7f53f773528]
>         at 
> org.apache.hive.service.cli.session.SessionManager.getSession(SessionManager.java:318)
>         at 
> org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:258)
>         at 
> org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:506)
>         at 
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)
>         at 
> org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)
>         at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
> {noformat}
> {noformat}
> WARN  org.apache.hive.service.cli.thrift.ThriftCLIService: 
> [HiveServer2-Handler-Pool: Thread-1060]: Error closing operation:
> org.apache.hive.service.cli.HiveSQLException: Invalid OperationHandle: 
> OperationHandle [opType=EXECUTE_STATEMENT, 
> getHandleIdentifier()=13d930dd-316c-4c09-9f44-fee5f483e73d]
>         at 
> org.apache.hive.service.cli.operation.OperationManager.getOperation(OperationManager.java:185)
>         at 
> org.apache.hive.service.cli.CLIService.closeOperation(CLIService.java:408)
>         at 
> org.apache.hive.service.cli.thrift.ThriftCLIService.CloseOperation(ThriftCLIService.java:664)
>         at 
> org.apache.hive.service.cli.thrift.TCLIService$Processor$CloseOperation.getResult(TCLIService.java:1513)
>         at 
> org.apache.hive.service.cli.thrift.TCLIService$Processor$CloseOperation.getResult(TCLIService.java:1498)
>         at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
>         at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to