From 04d7f964be90fa01f87d1b39eacada67a5581ee9 Mon Sep 17 00:00:00 2001 From: Carlos O'Ryan Date: Fri, 3 Dec 2021 19:12:51 +0000 Subject: [PATCH] ARROW-14979: [C++] fix process leaks in GCS integration tests --- cpp/src/arrow/filesystem/gcsfs_test.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cpp/src/arrow/filesystem/gcsfs_test.cc b/cpp/src/arrow/filesystem/gcsfs_test.cc index 30d37c18bf1..3024d329f70 100644 --- a/cpp/src/arrow/filesystem/gcsfs_test.cc +++ b/cpp/src/arrow/filesystem/gcsfs_test.cc @@ -65,9 +65,10 @@ culpa qui officia deserunt mollit anim id est laborum. class GcsIntegrationTest : public ::testing::Test { public: ~GcsIntegrationTest() override { + // Brutal shutdown, kill the full process group because the GCS testbench may launch + // additional children. + group_.terminate(); if (server_process_.valid()) { - // Brutal shutdown - server_process_.terminate(); server_process_.wait(); } } @@ -81,7 +82,7 @@ class GcsIntegrationTest : public ::testing::Test { ASSERT_THAT(exe_path, Not(IsEmpty())); server_process_ = bp::child(boost::this_process::environment(), exe_path, "-m", - "testbench", "--port", port_); + "testbench", "--port", port_, group_); // Create a bucket and a small file in the testbench. This makes it easier to // bootstrap GcsFileSystem and its tests. @@ -141,6 +142,7 @@ class GcsIntegrationTest : public ::testing::Test { std::mt19937_64 generator_; std::string port_; bp::child server_process_; + bp::group group_; }; TEST(GcsFileSystem, OptionsCompare) {