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

Uma Maheswara Rao G commented on HDFS-2452:
-------------------------------------------

Hey Cos,
 I just reviewed the patch. The problem is not for mocking the 
DataXciverServer#run method.
{code}
 DataXceiverServer spyServer = spy(server);
    doThrow(new OutOfMemoryError("Faulting...")).when(spyServer).run();
{code}

 We need to mock DataXceiver#run method.
Modified TestCase doesn't test the expected functionality. 
The problem to mock DataXceiver is , we can not get the reference of 
DataXceiver out. 
In real case we are getting the OutOfMemoryError from thread#start() native 
method before reaching run method itself.
That is the reason i trowed the exception from DataXceiver  constructor ( from 
dn.getConf()). Because we could not mock the start method of thread.

Test may pass because, main thread(test main) can complete before exactly 
completing the run method of DataXceiverServer#run. For solving this, i 
suggested one approach in my above comment.


Thanks
Uma
                
> OutOfMemoryError in DataXceiverServer takes down the DataNode
> -------------------------------------------------------------
>
>                 Key: HDFS-2452
>                 URL: https://issues.apache.org/jira/browse/HDFS-2452
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: data-node
>    Affects Versions: 0.22.0
>            Reporter: Konstantin Shvachko
>            Assignee: Uma Maheswara Rao G
>             Fix For: 0.22.0
>
>         Attachments: HDFS-2452-22branch.1.patch, HDFS-2452-22branch.patch, 
> HDFS-2452-22branch.patch
>
>
> OutOfMemoryError brings down DataNode, when DataXceiverServer tries to spawn 
> a new data transfer thread.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to