Hadoop Common
  1. Hadoop Common
  2. HADOOP-8177

MBeans shouldn't try to register when it fails to create MBeanName

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.24.0
    • Fix Version/s: 3.0.0
    • Component/s: metrics
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Target Version/s:

      Description

      MBeans.java
        static public ObjectName register(String serviceName, String nameName,
                                          Object theMbean) {
          final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
          ObjectName name = getMBeanName(serviceName, nameName);
          try {
            mbs.registerMBean(theMbean, name);
            LOG.debug("Registered "+ name);
            return name;
          } catch (InstanceAlreadyExistsException iaee) {
            if (LOG.isTraceEnabled()) {
              LOG.trace("Failed to register MBean \""+ name + "\"", iaee);
            } else {
              LOG.warn("Failed to register MBean \""+ name
                  + "\": Instance already exists.");
            }
          } catch (Exception e) {
            LOG.warn("Failed to register MBean \""+ name + "\"", e);
          }
          return null;
        }
      
        static private ObjectName getMBeanName(String serviceName, String nameName) {
          ObjectName name = null;
          String nameStr = "Hadoop:service="+ serviceName +",name="+ nameName;
          try {
            name = DefaultMetricsSystem.newMBeanName(nameStr);
          } catch (Exception e) {
            LOG.warn("Error creating MBean object name: "+ nameStr, e);
          }
          return name;
        }
      

      In getMBeanName() if DefaultMetricsSystem.newMBeanName(nameStr); fails with some reason like mbean already exists, getMBeanName() logs the exception and returns null and mbs.registerMBean(theMbean, name) in register() tries to register with null and throws exception with the message 'Failed to register MBean "null"'.

        Activity

        Devaraj K created issue -
        Devaraj K made changes -
        Field Original Value New Value
        Attachment HADOOP-8177.patch [ 12518647 ]
        Devaraj K made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Target Version/s 0.24.0 [ 12317652 ]
        Uma Maheswara Rao G made changes -
        Priority Major [ 3 ] Minor [ 4 ]
        Uma Maheswara Rao G made changes -
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Hadoop Flags Reviewed [ 10343 ]
        Fix Version/s 0.24.0 [ 12317652 ]
        Resolution Fixed [ 1 ]
        Arun C Murthy made changes -
        Fix Version/s 3.0.0 [ 12320357 ]
        Fix Version/s 0.24.0 [ 12317652 ]

          People

          • Assignee:
            Devaraj K
            Reporter:
            Devaraj K
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development