[ 
https://issues.apache.org/jira/browse/HADOOP-2344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549935
 ] 

Arun C Murthy commented on HADOOP-2344:
---------------------------------------

bq. Regarding the "Process.waitFor() hangs" issue, this patch clears the error 
stream using a separate thread while the input stream is read in the current 
thread (so that they happen in parallel). Once the streams are cleared, 
ShellCommand waits for the process to terminate and come out of waitFor(). 
Finally the process is destroyed closing the input/error streams. As done in 
ShellUtil, the process is made accessible outside ShellCommand so that the 
process can be externally terminated.

Amar, I'm not very sure this is the right approach. 

We've had this same structure before and had to remove it since we had a number 
of issues with threads reading the exec'ed process's stdout/stderr streams 
which kept hanging, and Owen finally had to resort to bash redirections: see 
HADOOP-1553 for details.

> Free up the buffers (input and error) while executing a shell command before 
> waiting for it to finish.
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-2344
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2344
>             Project: Hadoop
>          Issue Type: Bug
>    Affects Versions: 0.15.2
>            Reporter: Amar Kamat
>            Assignee: Amar Kamat
>             Fix For: 0.15.2
>
>         Attachments: HADOOP-2231.patch, HADOOP-2344.patch
>
>
> Process.waitFor() should be invoked after freeing up the input and error 
> stream.  While fixing https://issues.apache.org/jira/browse/HADOOP-2231 we 
> found that this might be a possible cause.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to