[ 
https://issues.apache.org/jira/browse/HDFS-15115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17021120#comment-17021120
 ] 

David Mollitor commented on HDFS-15115:
---------------------------------------

Thanks for looping me in.

 

I've never liked this setup with the {{StringBuilder}} from the start.  It's 
just not the right way to do DEBUG logging.  All the logging should be 
generated in one block and not concatenated piecemeal.  However, I submitted a 
patch (slightly updated from v1) so that the {{builder}} is always populated 
and will therefore not throw NPE.

 

However, please note that if the DEBUG logging is enabled sometime during 
execution, the first log message may be only partial... that is, the first few 
concatenations happen while DEBUG is disabled, and the last few happen while 
DEBUG is enabled, and then the {{StringBuilder}} is sent to the logging 
framework for output.

> Namenode crash caused by NPE in BlockPlacementPolicyDefault when dynamically 
> change logger to debug
> ---------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-15115
>                 URL: https://issues.apache.org/jira/browse/HDFS-15115
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: wangzhixiang
>            Assignee: David Mollitor
>            Priority: Major
>         Attachments: HDFS-15115.001.patch, HDFS-15115.2.patch
>
>
> To get debug info, we dynamically change the logger of 
> BlockPlacementPolicyDefault to debug when namenode is running. However, the 
> Namenode crashs. From the log, we find some NPE in 
> BlockPlacementPolicyDefault.chooseRandom. Because *StringBuilder builder* 
> will be used 4 times in BlockPlacementPolicyDefault.chooseRandom method. 
> While the *builder* only initializes in the first time of this method. If we 
> change the logger of BlockPlacementPolicyDefault to debug after the part, the 
> *builder* in remaining part is *NULL* and cause *NPE*



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to