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.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to