Uploaded image for project: 'Hadoop YARN'
  1. Hadoop YARN
  2. YARN-9349

When doTransition() method occurs exception, the log level practices are inconsistent

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0, 2.8.5
    • Fix Version/s: 3.3.0
    • Component/s: nodemanager
    • Labels:
    • Flags:
      Important

      Description

      There are inconsistent log level practices when code catches InvalidStateTransitionException for doTransition() method.

      **************WARN level******************
      /**
        file path: hadoop-2.8.5-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-nodemanager\src\main\java\org\apache\hadoop\yarn\server\nodemanager\containermanager\application\ApplicationImpl.java
        log statement line number: 482
        log level:warn
      **/
      try {
         // queue event requesting init of the same app
         newState = stateMachine.doTransition(event.getType(), event);
      } catch (InvalidStateTransitionException e) {
         LOG.warn("Can't handle this event at current state", e);
      }
      
      /**
        file path: hadoop-2.8.5-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-nodemanager\src\main\java\org\apache\hadoop\yarn\server\nodemanager\containermanager\localizer\LocalizedResource.java
        log statement line number: 200
        log level:warn
      **/
      try {
         newState = this.stateMachine.doTransition(event.getType(), event);
      } catch (InvalidStateTransitionException e) {
         LOG.warn("Can't handle this event at current state", e);
      }
      
      /**
        file path: hadoop-2.8.5-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-nodemanager\src\main\java\org\apache\hadoop\yarn\server\nodemanager\containermanager\container\ContainerImpl.java
        log statement line number: 1156
        log level:warn
      **/
      try {
          newState =
          stateMachine.doTransition(event.getType(), event);
      } catch (InvalidStateTransitionException e) {
          LOG.warn("Can't handle this event at current state: Current: ["
          + oldState + "], eventType: [" + event.getType() + "]", e);
      }
      
      **************ERROR level*****************
      /**
      file path: hadoop-2.8.5-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-resourcemanager\src\main\java\org\apache\hadoop\yarn\server\resourcemanager\rmapp\attempt\RMAppAttemptImpl.java
      log statement line number:878
      log level: error
      **/
      try {
         /* keep the master in sync with the state machine */
         this.stateMachine.doTransition(event.getType(), event);
      } catch (InvalidStateTransitionException e) {
         LOG.error("App attempt: " + appAttemptID
         + " can't handle this event at current state", e);
         onInvalidTranstion(event.getType(), oldState);
      }
      
      /**
      file path: hadoop-2.8.5-src\hadoop-yarn-project\hadoop-yarn\hadoop-yarn-server\hadoop-yarn-server-resourcemanager\src\main\java\org\apache\hadoop\yarn\server\resourcemanager\rmnode\RMNodeImpl.java
      log statement line number:623
      log level: error
      **/
      try {
         stateMachine.doTransition(event.getType(), event);
      } catch (InvalidStateTransitionException e) {
         LOG.error("Can't handle this event at current state", e);
         LOG.error("Invalid event " + event.getType() + 
         " on Node " + this.nodeId);
      }
      
      .... 
      //There are 8 similar code snippets with ERROR log level.
      
      

      After had a look on whole project, I found that there are 8 similar code snippets assgin the ERROR level, when doTransition() ocurrs InvalidStateTransitionException. And there are just 3 places choose  the WARN level when in same situations. Therefor, I think these 3 log statements should be assigned ERROR level to keep consistent with other code snippets.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              OneisAll Anuhan Torgonshar
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: