[ 
https://issues.apache.org/jira/browse/HIVE-21033?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Szehon Ho updated HIVE-21033:
-----------------------------
    Description: 
Its a bit tricky to reproduce, but we were able to do it (unfortunately) with 
our custom client that did not handle closing the session on the error case.  
But it may also happen for any client that just disconnects in the middle of 
this operation.

Basically you have a session with both HiveCommandOperation and SQLOperation.  
For example a session that does the operations (set a=b; select * from foobar; 
). 

The SQLOperation runs last and set SessionState.out and err to be System.out 
and System.err . Ref:  
[SQLOperation#setupSessionIO|https://github.com/apache/hive/blob/master/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java#L139]

Then the client terminates without closing the session. (In our case, a 
SemanticException triggered it).  The deleteContext is called, which closes the 
session:  Ref 
[ThriftBinaryCLIService#deleteContext|https://github.com/apache/hive/blob/f37c5de6c32b9395d1b34fa3c02ed06d1bfbf6eb/service/src/java/org/apache/hive/service/cli/thrift/ThriftBinaryCLIService.java#L141]

The Session closes all the operations, starting with HiveCommandOperation.  
This one closes all the streams, which it assumes is System.out and System.err 
as set by SQLOperation earlier.  Ref: 
[HiveCommandOperation#tearDownSessionIO|https://github.com/apache/hive/blob/f37c5de6c32b9395d1b34fa3c02ed06d1bfbf6eb/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java#L101]
 

After this, no more HiveServer2 output appears as System.out and System.err are 
closed.

  was:
Its a bit tricky to reproduce, but we were able to do it (unfortunately) with 
our custom client that did not handle closing the session on the error case.

Basically you have a session with both HiveCommandOperation and SQLOperation 
(set a=b; select * from foobar; ). 

Both will set up the session's out and err, with the SQLOperation setting it to 
be System.out and System.err . ref:  
[SQLOperation#setupSessionIO|https://github.com/apache/hive/blob/master/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java#L139]

Then the client terminates without closing the session. (In our case, a 
SemanticException triggered it).  The deleteContext is called, which closes the 
session:  ref 
[ThriftBinaryCLIService#deleteContext|https://github.com/apache/hive/blob/f37c5de6c32b9395d1b34fa3c02ed06d1bfbf6eb/service/src/java/org/apache/hive/service/cli/thrift/ThriftBinaryCLIService.java#L141]

The Session closes all the operations, starting with HiveCommandOperation.  
This one closes all the streams, which it assumes is not System.err but was set 
so by SQLOperation.  ref: 
[HiveCommandOperation#tearDownSessionIO|https://github.com/apache/hive/blob/f37c5de6c32b9395d1b34fa3c02ed06d1bfbf6eb/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java#L101]
 

After this, no more HiveServer2 logs appear.


> Sudden disconnect for a session with set and SQL operation cuts off any more 
> HiveServer2 logs
> ---------------------------------------------------------------------------------------------
>
>                 Key: HIVE-21033
>                 URL: https://issues.apache.org/jira/browse/HIVE-21033
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Szehon Ho
>            Priority: Major
>
> Its a bit tricky to reproduce, but we were able to do it (unfortunately) with 
> our custom client that did not handle closing the session on the error case.  
> But it may also happen for any client that just disconnects in the middle of 
> this operation.
> Basically you have a session with both HiveCommandOperation and SQLOperation. 
>  For example a session that does the operations (set a=b; select * from 
> foobar; ). 
> The SQLOperation runs last and set SessionState.out and err to be System.out 
> and System.err . Ref:  
> [SQLOperation#setupSessionIO|https://github.com/apache/hive/blob/master/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java#L139]
> Then the client terminates without closing the session. (In our case, a 
> SemanticException triggered it).  The deleteContext is called, which closes 
> the session:  Ref 
> [ThriftBinaryCLIService#deleteContext|https://github.com/apache/hive/blob/f37c5de6c32b9395d1b34fa3c02ed06d1bfbf6eb/service/src/java/org/apache/hive/service/cli/thrift/ThriftBinaryCLIService.java#L141]
> The Session closes all the operations, starting with HiveCommandOperation.  
> This one closes all the streams, which it assumes is System.out and 
> System.err as set by SQLOperation earlier.  Ref: 
> [HiveCommandOperation#tearDownSessionIO|https://github.com/apache/hive/blob/f37c5de6c32b9395d1b34fa3c02ed06d1bfbf6eb/service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java#L101]
>  
> After this, no more HiveServer2 output appears as System.out and System.err 
> are closed.



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

Reply via email to