You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2022/05/17 12:30:33 UTC

[impala] branch master updated: IMPALA-11291: deflake minidump-test by not starting JVM

This is an automated email from the ASF dual-hosted git repository.

stigahuang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f2447b1b IMPALA-11291: deflake minidump-test by not starting JVM
9f2447b1b is described below

commit 9f2447b1b382538404057fa9572a693f2215378c
Author: stiga-huang <hu...@gmail.com>
AuthorDate: Mon May 16 11:39:45 2022 +0800

    IMPALA-11291: deflake minidump-test by not starting JVM
    
    minidump-test is unified into unified-be-test which will always init the
    JVM and start the JVM pause monitor. It will print the following log to
    stdout:
    22/05/16 11:35:46 INFO util.JvmPauseMonitor: Starting JVM pause monitor
    
    It's printed concurrently with the minidump output, which makes the test
    flaky since it's verifying the output lines.
    
    This patch moves minidump-test out of unified-be-test and explicitly
    invokes InitCommonRuntime with init_jvm=false. So it won't be disrupted
    by the above log.
    
    Tests
     - The issue occurs when I run minidump-test several times repeatedly.
       After the fix, I can run minidump-test more than 2000 times without
       errors.
    
    Change-Id: I89f81d408a2e905d5dfdd7f87177ebe2079d4d27
    Reviewed-on: http://gerrit.cloudera.org:8080/18529
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/src/util/CMakeLists.txt   |  4 ++--
 be/src/util/minidump-test.cc | 28 ++++++++++++++++++++--------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/be/src/util/CMakeLists.txt b/be/src/util/CMakeLists.txt
index 8aa4386de..a471ac1db 100644
--- a/be/src/util/CMakeLists.txt
+++ b/be/src/util/CMakeLists.txt
@@ -164,7 +164,6 @@ add_library(UtilTests STATIC
   lru-multi-cache-test.cc
   metrics-test.cc
   min-max-filter-test.cc
-  minidump-test.cc
   openssl-util-test.cc
   os-info-test.cc
   os-util-test.cc
@@ -238,7 +237,8 @@ ADD_UNIFIED_BE_LSAN_TEST(lru-multi-cache-test "LruMultiCache.*")
 ADD_UNIFIED_BE_LSAN_TEST(logging-support-test "LoggingSupport.*")
 ADD_UNIFIED_BE_LSAN_TEST(metrics-test "MetricsTest.*")
 ADD_UNIFIED_BE_LSAN_TEST(min-max-filter-test "MinMaxFilterTest.*")
-ADD_UNIFIED_BE_LSAN_TEST(minidump-test "Minidump.*")
+# minidump-test is flaky when the jvm pause monitor is running. So it can't be unified.
+ADD_BE_LSAN_TEST(minidump-test)
 ADD_UNIFIED_BE_LSAN_TEST(openssl-util-test "OpenSSLUtilTest.*")
 ADD_UNIFIED_BE_LSAN_TEST(os-info-test "OsInfo.*")
 ADD_UNIFIED_BE_LSAN_TEST(os-util-test "OsUtil.*")
diff --git a/be/src/util/minidump-test.cc b/be/src/util/minidump-test.cc
index afcf4a883..571f5e256 100644
--- a/be/src/util/minidump-test.cc
+++ b/be/src/util/minidump-test.cc
@@ -22,7 +22,9 @@
 #include <gtest/gtest.h>
 
 #include "client/linux/handler/minidump_descriptor.h"
+#include "common/init.h"
 #include "common/thread-debug-info.h"
+#include "util/test-info.h"
 
 namespace impala {
 
@@ -44,10 +46,12 @@ TEST(Minidump, DumpCallback) {
   for (std::string output : {stdout, stderr}) {
     std::vector<std::string> lines;
     boost::split(lines, output, boost::is_any_of("\n\r"), boost::token_compress_on);
-    EXPECT_EQ(3, lines.size());
-    EXPECT_EQ("Minidump with no thread info available.", lines[0]);
-    EXPECT_TRUE(boost::regex_match(lines[1], wrote_minidump));
-    EXPECT_EQ("", lines[2]);
+    EXPECT_EQ(3, lines.size()) << output;
+    EXPECT_EQ("Minidump with no thread info available.", lines[0])
+        << lines[0] << "\nOutput:\n" << output;
+    EXPECT_TRUE(boost::regex_match(lines[1], wrote_minidump))
+        << lines[1] << "\nOutput:\n" << output;
+    EXPECT_EQ("", lines[2]) << output;
   }
 }
 
@@ -73,11 +77,19 @@ TEST(Minidump, DumpCallbackWithThread) {
   for (std::string output : {stdout, stderr}) {
     std::vector<std::string> lines;
     boost::split(lines, output, boost::is_any_of("\n\r"), boost::token_compress_on);
-    EXPECT_EQ(3, lines.size());
-    EXPECT_TRUE(boost::regex_match(lines[0], minidump_in_thread));
-    EXPECT_TRUE(boost::regex_match(lines[1], wrote_minidump));
-    EXPECT_EQ("", lines[2]);
+    EXPECT_EQ(3, lines.size()) << output;
+    EXPECT_TRUE(boost::regex_match(lines[0], minidump_in_thread))
+        << lines[0] << "\nOutput:\n" << output;
+    EXPECT_TRUE(boost::regex_match(lines[1], wrote_minidump))
+        << lines[1] << "\nOutput:\n" << output;
+    EXPECT_EQ("", lines[2]) << output;
   }
 }
 
 } // namespace impala
+
+int main(int argc, char **argv) {
+  ::testing::InitGoogleTest(&argc, argv);
+  impala::InitCommonRuntime(argc, argv, /*init_jvm*/ false, impala::TestInfo::BE_TEST);
+  return RUN_ALL_TESTS();
+}