Bug: NPE in MetricsMasterWrapperImpl.isRunning
Status: Resolved | Priority: Major | Resolution: Fixed
Created: 03/May/23 12:09

{quote}
2023-05-03T05:54:09,312 ERROR [HBase-Metrics2-1 {}] impl.MetricsSourceAdapter(202): Error getting metrics from source Master,sub=Server
java.lang.NullPointerException: null
	at org.apache.hadoop.hbase.master.MetricsMasterWrapperImpl.isRunning(MetricsMasterWrapperImpl.java:143) ~[classes/:?]
	at org.apache.hadoop.hbase.master.MetricsMasterSourceImpl.getMetrics(MetricsMasterSourceImpl.java:92) ~[hbase-hadoop-compat-3.0.0-alpha-4-SNAPSHOT.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.getMetrics(MetricsSourceAdapter.java:200) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.updateJmxCache(MetricsSourceAdapter.java:183) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.getMBeanInfo(MetricsSourceAdapter.java:156) ~[hadoop-common-3.2.4.jar:?]
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getNewMBeanClassName(DefaultMBeanServerInterceptor.java:333) ~[?:1.8.0_362]
	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:319) ~[?:1.8.0_362]
	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) ~[?:1.8.0_362]
	at org.apache.hadoop.metrics2.util.MBeans.register(MBeans.java:98) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.util.MBeans.register(MBeans.java:72) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.startMBeans(MetricsSourceAdapter.java:222) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.start(MetricsSourceAdapter.java:101) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.registerSource(MetricsSystemImpl.java:268) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.MetricsSystemImpl$1.postStart(MetricsSystemImpl.java:239) ~[hadoop-common-3.2.4.jar:?]
	at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_362]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_362]
	at org.apache.hadoop.metrics2.impl.MetricsSystemImpl$3.invoke(MetricsSystemImpl.java:324) ~[hadoop-common-3.2.4.jar:?]
	at com.sun.proxy.$Proxy31.postStart(Unknown Source) ~[?:?]
	at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.start(MetricsSystemImpl.java:193) ~[hadoop-common-3.2.4.jar:?]
	at org.apache.hadoop.metrics2.impl.JmxCacheBuster$JmxCacheBusterRunnable.run(JmxCacheBuster.java:102) ~[hbase-hadoop-compat-3.0.0-alpha-4-SNAPSHOT.jar:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_362]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_362]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_362]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_362]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_362]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_362]
	at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_362]
{quote}

Found this in the output when running TestAssignmentManager.testAssignSocketTimeout. It should not be related to the failure of the test but anyway, throwing NPE is not good so we need to check whether this is a test issue or a real issue in our code.