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

Capacity Schedular shows incorrect cluster information in the RM logs

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Duplicate
    • Affects Version/s: 0.23.0
    • Fix Version/s: None
    • Component/s: mrv2
    • Labels:
      None

      Description

      When we start the NM, after stopping it (in a quick session) CS shows incorrect information about clusterResource in the logs.

      I have encountered this issue in a pseudo cluster mode and steps to reproduce are

      1) start the YARN cluster
      2) stop a NM and start the NM again (in a quick session)

      There should be a NM running in the cluster however as I observed RM detects NM as dead, after default time since its actual unavailability(In this case NM has been stopped).

      If you start your NM before this time (default time), ResourceTracker throws IOEx, however, CS adds the NM's capacity to the clusterResource.

      After elapsed time (default time) when RM detects NM as dead, RM removes the NM and hence capacity of the cluster will be subtracted by the amount NM capacity.

      Eventually there is no NM running in the cluster, but capacity of the cluster is NM's capacity (by default)

      1. MAPREDUCE-3178.patch
        2 kB
        Bhallamudi Venkata Siva Kamesh

        Activity

        Hide
        Bhallamudi Venkata Siva Kamesh added a comment -

        When we start the NM again, as part of the registration, the following object will be created.

              RMNode rmNode = new RMNodeImpl(nodeId, rmContext, host, cmPort,
                  httpPort, resolve(host), capability);
        

        The above code internally calls

         context.getDispatcher().getEventHandler().handle(new NodeAddedSchedulerEvent(this)); 

        , which calls the CS#addNode() method. Here again this node's capability will be added to the clusterResource. In the mean time, the following part of the code throws exception

              if (this.rmContext.getRMNodes().putIfAbsent(nodeId, rmNode) != null) {
                throw new IOException("Duplicate registration from the node!");
              }
        
        Show
        Bhallamudi Venkata Siva Kamesh added a comment - When we start the NM again, as part of the registration, the following object will be created. RMNode rmNode = new RMNodeImpl(nodeId, rmContext, host, cmPort, httpPort, resolve(host), capability); The above code internally calls context.getDispatcher().getEventHandler().handle( new NodeAddedSchedulerEvent( this )); , which calls the CS#addNode() method. Here again this node's capability will be added to the clusterResource. In the mean time, the following part of the code throws exception if ( this .rmContext.getRMNodes().putIfAbsent(nodeId, rmNode) != null ) { throw new IOException( "Duplicate registration from the node!" ); }
        Hide
        Bhallamudi Venkata Siva Kamesh added a comment -

        I have attached a solution as a patch.Can be validated.

        Show
        Bhallamudi Venkata Siva Kamesh added a comment - I have attached a solution as a patch.Can be validated.
        Hide
        Arun C Murthy added a comment -

        Bala, this is a good to fix bug. Can you pls add a unit test? Tx.

        Show
        Arun C Murthy added a comment - Bala, this is a good to fix bug. Can you pls add a unit test? Tx.
        Hide
        Bhallamudi Venkata Siva Kamesh added a comment -

        Thanks Arun. I Will provide a complete patch.

        Show
        Bhallamudi Venkata Siva Kamesh added a comment - Thanks Arun. I Will provide a complete patch.
        Hide
        Devaraj K added a comment -

        Hi Kamesh/Arun,

        +        int time = conf.getInt(YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS,
        +            YarnConfiguration.DEFAULT_RM_NM_EXPIRY_INTERVAL_MS);
        +        String msg = "Duplicate registration from the node!";
        +        LOG.info(msg + " Waiting " + time + " ms, for registration.");
        +        try {
        +          Thread.sleep(time);
        +        } catch (InterruptedException e) {
        +        }
        

        I think it is not a good idea to make the registration process sleep for YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS time when the node manager goes down and comes up before the expiry interval. By default this value is 10 mins. During this time node manager will not be able to serve any request.

        I also saw the same issue for any scheduler and commented the same in MAPREDUCE-3070, trying to solve as part of that.
        https://issues.apache.org/jira/browse/MAPREDUCE-3070?focusedCommentId=13125711&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13125711

        Show
        Devaraj K added a comment - Hi Kamesh/Arun, + int time = conf.getInt(YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS, + YarnConfiguration.DEFAULT_RM_NM_EXPIRY_INTERVAL_MS); + String msg = "Duplicate registration from the node!" ; + LOG.info(msg + " Waiting " + time + " ms, for registration." ); + try { + Thread .sleep(time); + } catch (InterruptedException e) { + } I think it is not a good idea to make the registration process sleep for YarnConfiguration.RM_NM_EXPIRY_INTERVAL_MS time when the node manager goes down and comes up before the expiry interval. By default this value is 10 mins. During this time node manager will not be able to serve any request. I also saw the same issue for any scheduler and commented the same in MAPREDUCE-3070 , trying to solve as part of that. https://issues.apache.org/jira/browse/MAPREDUCE-3070?focusedCommentId=13125711&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13125711
        Hide
        Arun C Murthy added a comment -

        I missed the 'Thread.sleep'. That isn't something we shud ever do. We should just do the check early and throw, no need for the Thread.sleep.

        Show
        Arun C Murthy added a comment - I missed the 'Thread.sleep'. That isn't something we shud ever do. We should just do the check early and throw, no need for the Thread.sleep.
        Hide
        Arun C Murthy added a comment -

        Will be fixed via MAPREDUCE-2775

        Show
        Arun C Murthy added a comment - Will be fixed via MAPREDUCE-2775

          People

          • Assignee:
            Bhallamudi Venkata Siva Kamesh
            Reporter:
            Bhallamudi Venkata Siva Kamesh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development