Pankit Thapar created HIVE-7228:
-----------------------------------

             Summary: StreamPrinter should be joined to calling thread 
                 Key: HIVE-7228
                 URL: https://issues.apache.org/jira/browse/HIVE-7228
             Project: Hive
          Issue Type: Bug
          Components: CLI
    Affects Versions: 0.13.0
            Reporter: Pankit Thapar
            Priority: Minor


ISSUE:
StreamPrinter class is used for connecting an input stream (connected to 
output) of a process with the output stream of a Session 
(CliSessionState/SessionState class)
It acts as a pipe between the two and transfers data from input stream to the 
output stream. THE TRANSFER OPERATION RUNS IN A SEPARATE THREAD. 

>From some of the current usages of this class, I noticed that the calling 
>threads do not wait for the transfer operation to be completed. That is, the 
>calling thread does not join the SteamPrinter threads.
The calling thread would move forward thinking that the respective output 
stream already has the data needed. But, it is not always the right assumption 
since, it might happen that
the StreamPrinter thread did not finish execution by the time it was expected 
by the calling thread.

FIX:
To ensure that calling thread waits for the StreamPrinter threads to complete, 
StreamPrinter threads are joined to calling thread.

Please note , without the fix, TestCliDriverMethods#testRun failed sometimes 
(like 1 in 30 times). This test would not fail with this fix.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to