Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-5764

Potential NullPointerException in YARNRunner.killJob(JobID arg0)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I found YARNRunner.killJob(JobID arg0) can throw NullPointerException if job status is null.

      clientCache.getClient(arg0).getJobStatus(arg0); can be null.

      This can happen when there is history write is failed because of hdfs errors or staging directory is different from history server..

      We need to have null check otherwise killJob() is prone to throw NPE which cause joblient to exit.

      @Override
        public void killJob(JobID arg0) throws IOException, InterruptedException {
          /* check if the status is not running, if not send kill to RM */
          JobStatus status = clientCache.getClient(arg0).getJobStatus(arg0);
          if (status.getState() != JobStatus.State.RUNNING) {
            try {
              resMgrDelegate.killApplication(TypeConverter.toYarn(arg0).getAppId());
            } catch (YarnException e) {
              throw new IOException(e);
            }
            return;
          }
      .......
      ......
      .......
        }
      

        Issue Links

          Activity

          Rohith Sharma K S created issue -
          Jason Lowe made changes -
          Field Original Value New Value
          Link This issue duplicates MAPREDUCE-5542 [ MAPREDUCE-5542 ]
          Jason Lowe made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          Anthony Hsu made changes -
          Description I found YARNRunner.killJob(JobID arg0) can throw NullPointerExpetion if job status is null.
          bq. clientCache.getClient(arg0).getJobStatus(arg0); can be null.
          This can happen when there is history write is failed because of hdfs errors or staging directory is different from history server..
           
          We need to have null check otherwise killJob() is prone to throw NPE which cause joblient to exit.

          {noformat}
          @Override
            public void killJob(JobID arg0) throws IOException, InterruptedException {
              /* check if the status is not running, if not send kill to RM */
              JobStatus status = clientCache.getClient(arg0).getJobStatus(arg0);
              if (status.getState() != JobStatus.State.RUNNING) {
                try {
                  resMgrDelegate.killApplication(TypeConverter.toYarn(arg0).getAppId());
                } catch (YarnException e) {
                  throw new IOException(e);
                }
                return;
              }
          .......
          ......
          .......
            }
          {noformat}
          I found YARNRunner.killJob(JobID arg0) can throw NullPointerException if job status is null.
          bq. clientCache.getClient(arg0).getJobStatus(arg0); can be null.
          This can happen when there is history write is failed because of hdfs errors or staging directory is different from history server..
           
          We need to have null check otherwise killJob() is prone to throw NPE which cause joblient to exit.

          {noformat}
          @Override
            public void killJob(JobID arg0) throws IOException, InterruptedException {
              /* check if the status is not running, if not send kill to RM */
              JobStatus status = clientCache.getClient(arg0).getJobStatus(arg0);
              if (status.getState() != JobStatus.State.RUNNING) {
                try {
                  resMgrDelegate.killApplication(TypeConverter.toYarn(arg0).getAppId());
                } catch (YarnException e) {
                  throw new IOException(e);
                }
                return;
              }
          .......
          ......
          .......
            }
          {noformat}

            People

            • Assignee:
              Rohith Sharma K S
              Reporter:
              Rohith Sharma K S
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development