[ 
https://issues.apache.org/jira/browse/MAPREDUCE-5542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14174755#comment-14174755
 ] 

Rohith commented on MAPREDUCE-5542:
-----------------------------------

bq. Also the name doesn't seem to match how it's being used
Agree.. 

bq. The logic in the new isJobFinished does not look correct. isJobFinished 
will always return true as currently written
I think because of method name,it was being confused. But IIUC , It will return 
true if Job is not in terminal states(KILLED/FAILED/SUCCEDED). Once Job reaches 
terminal states(killed/failed/succeded), it return false.

bq. but we want to loop while the job is still active.
is below code OK?
{code}
  private boolean isJobInTerminalState(JobStatus status) {
    return status.getState() == JobStatus.State.KILLED
        || status.getState() == JobStatus.State.FAILED
        || status.getState() == JobStatus.State.SUCCEEDED;
  }

public void killJob(JobID arg0) throws IOException, InterruptedException {
//
   while ((currentTimeMillis < timeKillIssued + 10000L)
          && (!isJobInTerminalState(status))) {
// inside while loop
  }

if (status != null && !isJobInTerminalState(status)) {
      killApplication(appId);
    }
}
{code}

> Killing a job just as it finishes can generate an NPE in client
> ---------------------------------------------------------------
>
>                 Key: MAPREDUCE-5542
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-5542
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: client, mrv2
>    Affects Versions: 2.1.0-beta, 0.23.9
>            Reporter: Jason Lowe
>            Assignee: Rohith
>         Attachments: MAPREDUCE-5542.1.patch, MAPREDUCE-5542.2.patch, 
> MAPREDUCE-5542.3.patch, MAPREDUCE-5542.4.patch, MAPREDUCE-5542.5.patch
>
>
> If a client tries to kill a job just as the job is finishing then the client 
> can crash with an NPE.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to