The test was introduced in
HDFS-2451 to test behavior of DataXceiverServer in case OutOfMemoryError is thrown. There were several versions of the test using mocking and aspects. With current version I see that DataXceiverServer.run() does not catch OOME thrown as a fault injection.
What happens here is:
new DataXceiver(s, datanode, this)).start();
This creates a new thread, and then invokes DataXceiver.run() with fault injection, which throws OOME as expected. BUT, this is thrown in the new thread, which is different from the thread
DataXceiverServer.run() is in. And the new thread does not catch the exception.
I clearly see dispatchUncaughtException() when I run it in debugger.
I propose to remove the test.
I think we tried as hard as we could, but couldn't reasonably reproduce the scenario.