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

Chuan Liu updated YARN-894:
---------------------------

    Attachment: wait.sh
                wait.cmd
                ReadProcessStdout.java

Attach a Java file that verifies the above description. When executed on 
Windows, we have the following result:
{noformat}
C:\Users\chuanliu\Documents>java ReadProcessStdout wait.cmd
Process was destroyed!
-1
exit code: 1
{noformat}

On Linux, the results look like the following:
{noformat}
~$ java ReadProcessStdout ./wait.sh
Process was destroyed!
-1
Stream closed
java.io.IOException: Stream closed
        at 
java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:308)
        at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
        at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
        at java.io.InputStreamReader.read(InputStreamReader.java:167)
        at java.io.BufferedReader.fill(BufferedReader.java:136)
        at java.io.BufferedReader.readLine(BufferedReader.java:299)
        at java.io.BufferedReader.readLine(BufferedReader.java:362)
        at ReadProcessStdout.main(ReadProcessStdout.java:25)
{noformat}
                
> NodeHealthScriptRunner timeout checking is inaccurate on Windows
> ----------------------------------------------------------------
>
>                 Key: YARN-894
>                 URL: https://issues.apache.org/jira/browse/YARN-894
>             Project: Hadoop YARN
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 2.1.0-beta
>            Reporter: Chuan Liu
>            Assignee: Chuan Liu
>            Priority: Minor
>         Attachments: ReadProcessStdout.java, wait.cmd, wait.sh
>
>
> In {{NodeHealthScriptRunner}} method, we will set HealthChecker status based 
> on the Shell execution results. Some status are based on the exception thrown 
> during the Shell script execution.
> Currently, we will catch a non-ExitCodeException from ShellCommandExecutor, 
> and if Shell has the timeout status set at the same time, we will also set 
> HealthChecker status to timeout.
> We have following execution sequence in Shell:
> 1) In main thread, schedule a delayed timer task that will kill the original 
> process upon timeout.
> 2) In main thread, open a buffered reader and feed in the process's standard 
> input stream.
> 3) When timeout happens, the timer task will call {{Process#destroy()}}
>  to kill the main process.
> On Linux, when timeout happened and process killed, the buffered reader will 
> thrown an IOException with message: "Stream closed" in main thread.
> On Windows, we don't have the IOException. Only "-1" was returned from the 
> reader that indicates the buffer is finished. As a result, the timeout status 
> is not set on Windows, and {{TestNodeHealthService}} fails on Windows because 
> of this.
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to