You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2022/07/30 03:41:00 UTC
[jira] [Work logged] (HDFS-16704) Datanode return empty response instead of NPE for GetVolumeInfo during restarting
[ https://issues.apache.org/jira/browse/HDFS-16704?focusedWorklogId=796567&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-796567 ]
ASF GitHub Bot logged work on HDFS-16704:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Jul/22 03:40
Start Date: 30/Jul/22 03:40
Worklog Time Spent: 10m
Work Description: ZanderXu opened a new pull request, #4661:
URL: https://github.com/apache/hadoop/pull/4661
### Description of PR
During datanode starting, I found some NPE in logs:
```
Caused by: java.lang.NullPointerException: Storage not yet initialized
at org.apache.hadoop.thirdparty.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:899)
at org.apache.hadoop.hdfs.server.datanode.DataNode.getVolumeInfo(DataNode.java:3533)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:72)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:276)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:193)
at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175)
```
Because the storage of datanode not yet initialized when we trying to get metrics of datanode, and related code as below:
```
@Override // DataNodeMXBean
public String getVolumeInfo() {
Preconditions.checkNotNull(data, "Storage not yet initialized");
return JSON.toString(data.getVolumeInfoMap());
}
```
The logic is ok, but I feel that the more reasonable logic should be return an empty response instead of NPE, because InfoServer will be started before initBlockPool.
Issue Time Tracking
-------------------
Worklog Id: (was: 796567)
Remaining Estimate: 0h
Time Spent: 10m
> Datanode return empty response instead of NPE for GetVolumeInfo during restarting
> ---------------------------------------------------------------------------------
>
> Key: HDFS-16704
> URL: https://issues.apache.org/jira/browse/HDFS-16704
> Project: Hadoop HDFS
> Issue Type: Improvement
> Reporter: ZanderXu
> Assignee: ZanderXu
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> During datanode starting, I found some NPE in logs:
>
> {code:java}
> Caused by: java.lang.NullPointerException: Storage not yet initialized
> at org.apache.hadoop.thirdparty.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:899)
> at org.apache.hadoop.hdfs.server.datanode.DataNode.getVolumeInfo(DataNode.java:3533)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:72)
> at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:276)
> at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:193)
> at com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175) {code}
>
>
> Because the storage of datanode not yet initialized when we trying to get metrics of datanode, and related code as below:
> {code:java}
> @Override // DataNodeMXBean
> public String getVolumeInfo() {
> Preconditions.checkNotNull(data, "Storage not yet initialized");
> return JSON.toString(data.getVolumeInfoMap());
> } {code}
> The logic is ok, but I feel that more reasonable logic should be return a empty response instead of NPE, because InfoServer will be started before initBlockPool.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org