HDFS-9515. NPE when MiniDFSCluster#shutdown is invoked on uninitialized reference. (Contributed by Wei-Chiu Chuang)

This commit is contained in:
Arpit Agarwal 2015-12-17 13:43:27 -08:00
parent db37f02dc7
commit 2f623fb8cc
152 changed files with 336 additions and 68 deletions

View File

@ -2510,6 +2510,9 @@ Release 2.8.0 - UNRELEASED
HDFS-9570. Minor typos, grammar, and case sensitivity cleanup in
HdfsPermissionsGuide.md's (Travis Campbell via aw)
HDFS-9515. NPE when MiniDFSCluster#shutdown is invoked on uninitialized
reference. (Wei-Chiu Chuang via Arpit Agarwal)
Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES

View File

@ -63,6 +63,7 @@ public class TestBootstrapStandbyWithBKJM {
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -86,6 +86,7 @@ public class TestRefreshCallQueue {
public void tearDown() throws Exception {
if(cluster!=null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -49,9 +49,11 @@ public class TestAclCLI extends CLITestHelperDFS {
super.tearDown();
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -76,9 +76,11 @@ public class TestCacheAdminCLI extends CLITestHelper {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (dfsCluster != null) {
dfsCluster.shutdown();
dfsCluster = null;
}
Thread.sleep(2000);
super.tearDown();

View File

@ -86,9 +86,11 @@ public class TestCryptoAdminCLI extends CLITestHelperDFS {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (dfsCluster != null) {
dfsCluster.shutdown();
dfsCluster = null;
}
Thread.sleep(2000);
super.tearDown();

View File

@ -58,9 +58,11 @@ public class TestDeleteCLI extends CLITestHelperDFS {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (dfsCluster != null) {
dfsCluster.shutdown();
dfsCluster = null;
}
Thread.sleep(2000);
super.tearDown();

View File

@ -61,9 +61,11 @@ public class TestErasureCodingCLI extends CLITestHelper {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (dfsCluster != null) {
dfsCluster.shutdown();
dfsCluster = null;
}
Thread.sleep(2000);
super.tearDown();

View File

@ -77,9 +77,11 @@ public class TestHDFSCLI extends CLITestHelperDFS {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (dfsCluster != null) {
dfsCluster.shutdown();
dfsCluster = null;
}
Thread.sleep(2000);
super.tearDown();

View File

@ -67,9 +67,11 @@ public class TestXAttrCLI extends CLITestHelperDFS {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (dfsCluster != null) {
dfsCluster.shutdown();
dfsCluster = null;
}
Thread.sleep(2000);
super.tearDown();

View File

@ -58,8 +58,10 @@ public class TestFcHdfsCreateMkdir extends
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Override
@Before

View File

@ -65,8 +65,10 @@ public class TestFcHdfsPermission extends FileContextPermissionBase {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Override
@Before

View File

@ -96,8 +96,10 @@ public class TestFcHdfsSetUMask {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
{
try {

View File

@ -96,8 +96,10 @@ abstract public class TestSymlinkHdfs extends SymlinkBaseTest {
@AfterClass
public static void afterClassTeardown() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Test(timeout=10000)
/** Access a file using a link that spans Hdfs to LocalFs */

View File

@ -62,6 +62,7 @@ public class HDFSContract extends AbstractFSContract {
public static void destroyCluster() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -60,9 +60,11 @@ public class TestHdfsTextCommand {
public void tearDown() throws IOException{
if(fs != null){
fs.close();
fs = null;
}
if(cluster != null){
cluster.shutdown();
cluster = null;
}
}

View File

@ -88,8 +88,10 @@ public class TestViewFileSystemHdfs extends ViewFileSystemBaseTest {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Override
@Before

View File

@ -76,8 +76,10 @@ public class TestViewFileSystemWithAcls {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Before
public void setUp() throws Exception {

View File

@ -71,8 +71,10 @@ public class TestViewFileSystemWithXAttrs {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Before
public void setUp() throws Exception {

View File

@ -64,8 +64,10 @@ public class TestViewFsAtHdfsRoot extends ViewFsBaseTest {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Override
@Before

View File

@ -64,8 +64,10 @@ public class TestViewFsHdfs extends ViewFsBaseTest {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Override
@Before

View File

@ -76,8 +76,10 @@ public class TestViewFsWithAcls {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Before
public void setUp() throws Exception {

View File

@ -70,8 +70,10 @@ public class TestViewFsWithXAttrs {
@AfterClass
public static void ClusterShutdownAtEnd() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
@Before
public void setUp() throws Exception {

View File

@ -68,8 +68,10 @@ public class FileAppendTest4 {
@AfterClass
public static void tearDown() {
if (cluster != null) {
cluster.shutdown();
}
}
/**
* Comprehensive test for append

View File

@ -56,8 +56,14 @@ public class TestAbandonBlock {
@After
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
@Test

View File

@ -43,9 +43,11 @@ public class TestBlocksScheduledCounter {
public void tearDown() throws IOException {
if (fs != null) {
fs.close();
fs = null;
}
if(cluster!=null){
cluster.shutdown();
cluster = null;
}
}

View File

@ -82,8 +82,14 @@ public class TestClientReportBadBlock {
@After
public void shutDownCluster() throws IOException {
if (dfs != null) {
dfs.close();
dfs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
/*

View File

@ -54,6 +54,7 @@ public class TestDFSClientExcludedNodes {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -88,6 +88,7 @@ public class TestDFSClientFailover {
public void tearDownCluster() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -82,6 +82,7 @@ public class TestDFSClientSocketSize {
if (cluster != null) {
LOG.info("Shutting down MiniDFSCluster.");
cluster.shutdown();
cluster = null;
}
}

View File

@ -188,7 +188,10 @@ public class TestDFSFinalize {
@After
public void tearDown() throws Exception {
LOG.info("Shutting down MiniDFSCluster");
if (cluster != null) cluster.shutdown();
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
public static void main(String[] args) throws Exception {

View File

@ -150,6 +150,8 @@ public class TestDFSOutputStream {
@AfterClass
public static void tearDown() {
if (cluster != null) {
cluster.shutdown();
}
}
}

View File

@ -123,6 +123,7 @@ public class TestDFSPermission {
public void tearDown() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -346,7 +346,10 @@ public class TestDFSRollback {
@After
public void tearDown() throws Exception {
LOG.info("Shutting down MiniDFSCluster");
if (cluster != null) cluster.shutdown();
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
public static void main(String[] args) throws Exception {

View File

@ -282,7 +282,10 @@ public class TestDFSStartupVersions {
@After
public void tearDown() throws Exception {
LOG.info("Shutting down MiniDFSCluster");
if (cluster != null) cluster.shutdown();
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
public static void main(String[] args) throws Exception {

View File

@ -452,6 +452,9 @@ public class TestDFSStorageStateRecovery {
@After
public void tearDown() throws Exception {
LOG.info("Shutting down MiniDFSCluster");
if (cluster != null) cluster.shutdown();
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
}

View File

@ -86,6 +86,7 @@ public class TestDFSStripedInputStream {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -69,6 +69,7 @@ public class TestDFSStripedOutputStream {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -69,7 +69,10 @@ public class TestDataTransferKeepalive {
@After
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
/**

View File

@ -126,6 +126,7 @@ public class TestDecommission {
cleanupFile(localFileSys, dir);
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -170,6 +170,7 @@ public class TestEncryptionZones {
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
EncryptionFaultInjector.instance = new EncryptionFaultInjector();
}

View File

@ -87,6 +87,7 @@ public class TestEncryptionZonesWithHA {
public void shutdownCluster() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -61,6 +61,7 @@ public class TestErasureCodingPolicies {
public void shutdownCluster() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -57,6 +57,7 @@ public class TestErasureCodingPolicyWithSnapshot {
public void shutdownCluster() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -84,9 +84,11 @@ public class TestFileConcurrentReader {
@After
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
private void init(Configuration conf) throws IOException {
if (cluster != null) {

View File

@ -77,9 +77,13 @@ public class TestFileStatus {
@AfterClass
public static void testTearDown() throws Exception {
if (fs != null) {
fs.close();
}
if (cluster != null) {
cluster.shutdown();
}
}
private void checkFile(FileSystem fileSys, Path name, int repl)
throws IOException, InterruptedException, TimeoutException {

View File

@ -50,6 +50,7 @@ public class TestFileStatusWithECPolicy {
public void after() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -52,6 +52,7 @@ public class TestGetFileChecksum {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -45,9 +45,11 @@ public class TestHDFSFileSystemContract extends FileSystemContractBaseTest {
@Override
protected void tearDown() throws Exception {
super.tearDown();
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
@Override
protected String getDefaultWorkingDirectory() {

View File

@ -47,6 +47,7 @@ public class TestHdfsAdmin {
public void shutDownCluster() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -57,6 +57,7 @@ public class TestLeaseRecovery {
public void shutdown() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -101,8 +101,10 @@ public class TestLeaseRecovery2 {
*/
@AfterClass
public static void tearDown() throws IOException {
if (cluster != null) {
IOUtils.closeStream(dfs);
if (cluster != null) {cluster.shutdown();}
cluster.shutdown();
}
}
/**

View File

@ -46,9 +46,11 @@ public class TestListFilesInDFS extends TestListFiles {
@AfterClass
public static void testShutdown() throws Exception {
if (cluster != null) {
fs.close();
cluster.shutdown();
}
}
protected static Path getTestDir() {
return new Path("/main_");

View File

@ -83,8 +83,10 @@ public class TestListFilesInFileContext {
@AfterClass
public static void testShutdown() throws Exception {
if (cluster != null) {
cluster.shutdown();
}
}
/** Test when input path is a file */
@Test

View File

@ -65,11 +65,14 @@ public class TestPipelines {
@After
public void shutDownCluster() throws IOException {
if (fs != null)
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdownDataNodes();
cluster.shutdown();
cluster = null;
}
}

View File

@ -77,6 +77,7 @@ public class TestReadStripedFileWithDecoding {
public void tearDown() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -61,6 +61,7 @@ public class TestReadStripedFileWithMissingBlocks {
public void tearDown() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -97,6 +97,7 @@ public class TestRecoverStripedFile {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -91,6 +91,7 @@ public class TestReservedRawPaths {
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -90,9 +90,11 @@ public class TestSafeMode {
public void tearDown() throws IOException {
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -63,6 +63,7 @@ public class TestSafeModeWithStripedFile {
public void tearDown() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -86,7 +86,10 @@ public class TestWriteRead {
@After
public void shutdown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
// Equivalence of @Before for cluster mode testing.

View File

@ -76,6 +76,7 @@ public class TestWriteReadStripedFile {
public void tearDown() throws IOException {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -67,6 +67,7 @@ public class TestSaslDataTransfer extends SaslDataTransferTestCase {
IOUtils.cleanup(null, fs);
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -154,9 +154,11 @@ public class TestSecureNNWithQJM {
IOUtils.cleanup(null, fs);
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
if (mjc != null) {
mjc.shutdown();
mjc = null;
}
}

View File

@ -114,6 +114,7 @@ public class TestQuorumJournalManager {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -61,6 +61,7 @@ public class TestJournalNodeMXBean {
public void cleanup() throws IOException {
if (jCluster != null) {
jCluster.shutdown();
jCluster = null;
}
}

View File

@ -84,6 +84,7 @@ public class TestDelegationToken {
public void tearDown() throws Exception {
if(cluster!=null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -67,6 +67,7 @@ public class TestBlockStatsMXBean {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -70,6 +70,7 @@ public class TestComputeInvalidateWork {
public void teardown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -74,6 +74,7 @@ public class TestPendingInvalidateBlock {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -93,6 +93,7 @@ public class TestSequentialBlockGroupId {
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -115,10 +115,12 @@ public abstract class BlockReportTestBase {
public void shutDownCluster() throws IOException {
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdownDataNodes();
cluster.shutdown();
cluster = null;
}
}

View File

@ -59,8 +59,10 @@ public class TestDataNodeExit {
@After
public void tearDown() throws Exception {
if (cluster != null)
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
private void stopBPServiceThreads(int numStopThreads, DataNode dn)

View File

@ -116,12 +116,15 @@ public class TestDataNodeVolumeFailure {
public void tearDown() throws Exception {
if(data_fail != null) {
FileUtil.setWritable(data_fail, true);
data_fail = null;
}
if(failedDir != null) {
FileUtil.setWritable(failedDir, true);
failedDir = null;
}
if(cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -89,6 +89,7 @@ public class TestDataNodeVolumeFailureReporting {
IOUtils.cleanup(LOG, fs);
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -78,6 +78,7 @@ public class TestDataNodeVolumeFailureToleration {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -71,7 +71,10 @@ public class TestDiskError {
@After
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
/**

View File

@ -149,9 +149,11 @@ public class TestFsDatasetCache {
DFSTestUtil.verifyExpectedCacheUsage(0, 0, fsd);
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
// Restore the original CacheManipulator
NativeIO.POSIX.setCacheManipulator(prevCacheManipulator);

View File

@ -101,10 +101,13 @@ public class TestIncrementalBrVariations {
@After
public void shutDownCluster() throws IOException {
if (cluster != null) {
client.close();
fs.close();
cluster.shutdownDataNodes();
cluster.shutdown();
cluster = null;
}
}
/**

View File

@ -58,6 +58,7 @@ public class TestAclConfigFlag {
IOUtils.cleanup(null, fs);
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -60,6 +60,7 @@ public class TestAddBlock {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -66,6 +66,7 @@ public class TestAddBlockRetry {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -75,6 +75,7 @@ public class TestAddOverReplicatedStripedBlocks {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -82,6 +82,7 @@ public class TestAddStripedBlocks {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -137,8 +137,14 @@ public class TestAuditLogs {
@After
public void teardownCluster() throws Exception {
util.cleanup(fs, "/srcdat");
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
/** test that allowed operation puts proper entry in audit log */

View File

@ -494,9 +494,11 @@ public class TestBackupNode {
assertTrue(e.getLocalizedMessage(), false);
} finally {
fileSys.close();
if (cluster != null) {
cluster.shutdown();
}
}
}
/**
* Verify that a file can be read both from NameNode and BackupNode.

View File

@ -83,6 +83,7 @@ public class TestBlockPlacementPolicyRackFaultTolerant {
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -158,6 +158,7 @@ public class TestCacheDirectives {
waitForCachedBlocks(namenode, 0, 0, "teardown");
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
// Restore the original CacheManipulator
NativeIO.POSIX.setCacheManipulator(prevCacheManipulator);

View File

@ -58,6 +58,7 @@ public class TestCommitBlockWithInvalidGenStamp {
public void tearDown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -62,7 +62,10 @@ public class TestDeadDatanode {
@After
public void cleanup() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}
/**

View File

@ -71,6 +71,7 @@ public class TestDefaultBlockPlacementPolicy {
public void teardown() {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -71,6 +71,7 @@ public class TestDiskspaceQuotaUpdate {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -97,9 +97,11 @@ public class TestEditLogAutoroll {
public void tearDown() throws Exception {
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -70,11 +70,14 @@ public class TestEditLogJournalFailures {
@After
public void shutDownMiniCluster() throws IOException {
if (fs != null)
if (fs != null) {
fs.close();
fs = null;
}
if (cluster != null) {
try {
cluster.shutdown();
cluster = null;
} catch (ExitException ee) {
// Ignore ExitExceptions as the tests may result in the
// NameNode doing an immediate shutdown.

View File

@ -108,6 +108,7 @@ public class TestFSDirectory {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -55,8 +55,10 @@ public class TestFSImageWithAcl {
@AfterClass
public static void tearDown() {
if (cluster != null) {
cluster.shutdown();
}
}
private void testAcl(boolean persistNamespace) throws IOException {
Path p = new Path("/p");

View File

@ -89,6 +89,7 @@ public class TestFSImageWithSnapshot {
public void tearDown() throws Exception {
if (cluster != null) {
cluster.shutdown();
cluster = null;
}
}

View File

@ -62,8 +62,10 @@ public class TestFSImageWithXAttr {
@AfterClass
public static void tearDown() {
if (cluster != null) {
cluster.shutdown();
}
}
private void testXAttr(boolean persistNamespace) throws IOException {
Path path = new Path("/p");

View File

@ -110,8 +110,14 @@ public class TestFileTruncate {
@After
public void tearDown() throws IOException {
if(fs != null) fs.close();
if(cluster != null) cluster.shutdown();
if(fs != null) {
fs.close();
fs = null;
}
if(cluster != null) {
cluster.shutdown();
cluster = null;
}
}
/**

Some files were not shown because too many files have changed in this diff Show More