ConfX created HDFS-17107: ---------------------------- Summary: Null Pointer Exception after turned on detail metric for namenode lock Key: HDFS-17107 URL: https://issues.apache.org/jira/browse/HDFS-17107 Project: Hadoop HDFS Issue Type: Bug Reporter: ConfX Attachments: reproduce.sh
h2. What happened After setting {{{}dfs.namenode.lock.detailed-metrics.enabled=true{}}}, running test {{org.apache.hadoop.hdfs.server.namenode.TestFSNamesystemLock#testFSWriteLockReportSuppressed}} results in a {{{}NullPointerException{}}}. h2. Where's the bug In class {{{}FSNameSystemLock{}}}: {noformat} if (metricsEnabled) { String opMetric = getMetricName(operationName, isWrite); detailedHoldTimeMetrics.add(opMetric, value);{noformat} here it may be that the metric is enabled but the detailedHoldTimeMetrics is null. h2. How to reproduce # Set {{dfs.namenode.lock.detailed-metrics.enabled=true}} # Run {{org.apache.hadoop.hdfs.server.namenode.TestFSNamesystemLock#testFSWriteLockReportSuppressed}} and the following exception should be observed: {noformat} java.lang.NullPointerException at org.apache.hadoop.hdfs.server.namenode.FSNamesystemLock.addMetric(FSNamesystemLock.java:359) at org.apache.hadoop.hdfs.server.namenode.FSNamesystemLock.writeUnlock(FSNamesystemLock.java:287) at org.apache.hadoop.hdfs.server.namenode.FSNamesystemLock.writeUnlock(FSNamesystemLock.java:236) at org.apache.hadoop.hdfs.server.namenode.TestFSNamesystemLock.testFSWriteLockReportSuppressed(TestFSNamesystemLock.java:433){noformat} For an easy reproduction, run the reproduce.sh in the attachment. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org