Kaynağa Gözat

HADOOP-8027. Visiting /jmx on the daemon web interfaces may print unnecessary error in logs. Contributed by Aaron T. Myers. Ported to hadoop-1 by Hitesh Shah.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.0@1335192 13f79535-47bb-0310-9956-ffa450edef68
Matthew Foley 13 yıl önce
ebeveyn
işleme
57009586dd

+ 3 - 0
CHANGES.txt

@@ -92,6 +92,9 @@ Release 1.0.3 - 2012.05.07
     MAPREDUCE-4012. Hadoop Job setup error leaves no useful info to users
     (when LinuxTaskController is used) (tgraves)
 
+    HADOOP-8027. Visiting /jmx on the daemon web interfaces may print unnecessary
+    error in logs (Aaron Myers and Hitesh Shah)
+
 Release 1.0.2 - 2012.03.24
 
   NEW FEATURES

+ 10 - 0
src/core/org/apache/hadoop/jmx/JMXJsonServlet.java

@@ -34,6 +34,7 @@ import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
+import javax.management.RuntimeMBeanException;
 import javax.management.openmbean.CompositeData;
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.TabularData;
@@ -249,6 +250,15 @@ public class JMXJsonServlet extends HttpServlet {
     Object value = null;
     try {
       value = mBeanServer.getAttribute(oname, attName);
+    } catch (RuntimeMBeanException e) {
+      // UnsupportedOperationExceptions happen in the normal course of business,
+      // so no need to log them as errors all the time.
+      if (e.getCause() instanceof UnsupportedOperationException) {
+        LOG.debug("getting attribute "+attName+" of "+oname+" threw an exception", e);
+      } else {
+        LOG.error("getting attribute "+attName+" of "+oname+" threw an exception", e);
+      }
+      return;
     } catch (AttributeNotFoundException e) {
       //Ignored the attribute was not found, which should never happen because the bean
       //just told us that it has this attribute, but if this happens just don't output

+ 5 - 0
src/docs/releasenotes.html

@@ -62,6 +62,11 @@
      <b>FindBugs OutOfMemoryError</b><br>
      <blockquote>When running the findbugs target from Jenkins, I get an OutOfMemory error.<br>The &quot;effort&quot; in FindBugs is set to Max which ends up using a lot of memory to go through all the classes. The jvmargs passed to FindBugs is hardcoded to 512 MB max.<br><br>We can leave the default to 512M, as long as we pass this as an ant parameter which can be overwritten in individual cases through -D, or in the build.properties file (either basedir, or user&apos;s home directory).<br></blockquote></li>
 
+<li> <a href="https://issues.apache.org/jira/browse/HADOOP-8027">HADOOP-8027</a>.
+     Minor improvement reported by qwertymaniac and fixed by atm (metrics)<br>
+     <b>Visiting /jmx on the daemon web interfaces may print unnecessary error in logs</b><br>
+     <blockquote>Logs that follow a {{/jmx}} servlet visit:<br><br>{code}<br>11/11/22 12:09:52 ERROR jmx.JMXJsonServlet: getting attribute UsageThreshold of java.lang:type=MemoryPool,name=Par Eden Space threw an exception<br>javax.management.RuntimeMBeanException: java.lang.UnsupportedOperationException: Usage threshold is not supported<br>	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.rethrow(DefaultMBeanServerInterceptor.java:856)<br>...<br>{code}</blockquote></li>
+
 <li> <a href="https://issues.apache.org/jira/browse/HADOOP-8151">HADOOP-8151</a>.
      Major bug reported by tlipcon and fixed by mattf (io, native)<br>
      <b>Error handling in snappy decompressor throws invalid exceptions</b><br>