[ 
https://issues.apache.org/jira/browse/HADOOP-2512?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12555540#action_12555540
 ] 

Amar Kamat commented on HADOOP-2512:
------------------------------------

 1) Sorry for the typo.
2) The way the Exception message is composed should be changed. Basically its 
composed of
    - Error stream output
    - Exit code error message

So
{code}
   if (errMsg.length() == 0) {
     errMsg.append("Command exit with status code " + exitCode);
   }
{code}
should be changed to
{code}
   if (errMsg.length() == 0) {
     errMsg.insert(0,"Command exit with status code " + exitCode + ",\n");
   }
{code}
3) In the patch you are waiting for the error stream to finish with the output 
stream still open. This could possibly lead to a deadlock
4) The reason {{completed}} was introduced is as follows
- If {{parseExec}} generates an exception then there is no need to wait for the 
error thread to complete, so interrupt
- the exit code is sufficient for determining the error and hence its fine to 
interrupt the error thread
- in normal case since there is no error its fine to do as join

A better solution would be to interrupt error thread for exception on 
{{parseExec}} and join for others. In which case the 'completed=true' should be 
done before throwing an exception.
Except the change of {{errThread.join}} block, rest seems fine.
comments?


> error stream handling in Shell executor 
> ----------------------------------------
>
>                 Key: HADOOP-2512
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2512
>             Project: Hadoop
>          Issue Type: Bug
>          Components: util
>    Affects Versions: 0.16.0
>            Reporter: Raghu Angadi
>            Assignee: Raghu Angadi
>             Fix For: 0.16.0
>
>         Attachments: HADOOP-2512.patch
>
>
> Fix a couple of issues while handling error stream in Shell (added in 
> HADOOP-2344) :
> # fix typo in {{System.getProperty("line.seperator")}}, currently it adds 
> "null" instead of "\n".
> # completed is not set to {{true}} when a process exits with an error.
> # In normal error case, it reads errMsg (to create IOException) before 
> waiting for errThread to complete, which results in in consistent error 
> message. I will attach a patch.

-- 
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