kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danburk...@apache.org
Subject [3/3] kudu git commit: Fix MiniKdc dtor crash
Date Tue, 25 Oct 2016 19:39:54 GMT
Fix MiniKdc dtor crash

The C++ MiniKdc had a bug that caused a CHECK failure when the dtor ran
while stopped.

Change-Id: Iccfa5cdbfadd82d021e9ccede020e1d19e7054fc
Reviewed-on: http://gerrit.cloudera.org:8080/4839
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Dan Burkert <danburkert@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/6ed6989a
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/6ed6989a
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/6ed6989a

Branch: refs/heads/master
Commit: 6ed6989ab99a415b9442559261cdee719b2eff57
Parents: 8972e9e
Author: Dan Burkert <danburkert@apache.org>
Authored: Tue Oct 25 11:30:21 2016 -0700
Committer: Dan Burkert <danburkert@apache.org>
Committed: Tue Oct 25 19:39:32 2016 +0000

----------------------------------------------------------------------
 .../src/test/java/org/apache/kudu/client/TestMiniKdc.java      | 6 ++++++
 src/kudu/security/mini_kdc-test.cc                             | 6 ++++++
 src/kudu/security/mini_kdc.cc                                  | 4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/6ed6989a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKdc.java
----------------------------------------------------------------------
diff --git a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKdc.java b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKdc.java
index e1628dd..609b1a0 100644
--- a/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKdc.java
+++ b/java/kudu-client/src/test/java/org/apache/kudu/client/TestMiniKdc.java
@@ -45,4 +45,10 @@ public class TestMiniKdc {
       assertTrue(klist.contains("krbtgt/KRBTEST.COM@KRBTEST.COM"));
     }
   }
+
+  @Test
+  public void testStopClose() throws Exception {
+    // Test that closing a stopped KDC does not throw.
+    MiniKdc.withDefaults().close();
+  }
 }

http://git-wip-us.apache.org/repos/asf/kudu/blob/6ed6989a/src/kudu/security/mini_kdc-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/mini_kdc-test.cc b/src/kudu/security/mini_kdc-test.cc
index 26a3621..2b88990 100644
--- a/src/kudu/security/mini_kdc-test.cc
+++ b/src/kudu/security/mini_kdc-test.cc
@@ -48,4 +48,10 @@ TEST(MiniKdcTest, TestBasicOperation) {
   ASSERT_STR_CONTAINS(klist, "krbtgt/KRBTEST.COM@KRBTEST.COM");
 }
 
+// Regression test to ensure that dropping a stopped MiniKdc doesn't panic.
+TEST(MiniKdcTest, TestStopDrop) {
+  MiniKdcOptions options;
+  MiniKdc kdc(options);
+}
+
 } // namespace kudu

http://git-wip-us.apache.org/repos/asf/kudu/blob/6ed6989a/src/kudu/security/mini_kdc.cc
----------------------------------------------------------------------
diff --git a/src/kudu/security/mini_kdc.cc b/src/kudu/security/mini_kdc.cc
index 25373fd..9daa527 100644
--- a/src/kudu/security/mini_kdc.cc
+++ b/src/kudu/security/mini_kdc.cc
@@ -60,7 +60,9 @@ MiniKdc::MiniKdc(const MiniKdcOptions& options)
 }
 
 MiniKdc::~MiniKdc() {
-  WARN_NOT_OK(Stop(), "Unable to stop MiniKdc");
+  if (kdc_process_) {
+    WARN_NOT_OK(Stop(), "Unable to stop MiniKdc");
+  }
 }
 
 vector<string> MiniKdc::MakeArgv(const vector<string>& in_argv) {


Mime
View raw message