From cb652aa9af1ea39fccafdaec93aea65842092c67 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 7 May 2026 18:49:24 +0200 Subject: [PATCH 1/4] Remove step name: Pin MSYS2 packages --- .github/workflows/cpp.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index b2acdab3fd2..d82dadbab6e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -366,40 +366,6 @@ jobs: - name: Setup MSYS2 shell: msys2 {0} run: ci/scripts/msys2_setup.sh cpp - - name: Pin MSYS2 packages - # Temporary workaround for #49930: gcc 16 surfaces a cluster of 5 - # MINGW64 test failures. Pinning gcc-libs to 15.2 (and C++ packages - # rebuilt against gcc-libs 16.1, for ABI compatibility) avoids all - # of them. #49272/#49462 cover one (arrow-json-test); the other 4 - # (async-utility-test, threading-utility-test, dataset-writer-test - # `bad_weak_ptr`, dataset-file-test) need separate fixes — see #49930. - # Remove once all 5 pass on current upstream MSYS2 without these pins - if: matrix.msystem_upper == 'MINGW64' - shell: msys2 {0} - run: | - set -ex - base="https://repo.msys2.org/mingw/mingw64" - urls=( - "$base/mingw-w64-x86_64-gcc-libs-15.2.0-14-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-gcc-15.2.0-14-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-aws-crt-cpp-0.38.4-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-boost-libs-1.91.0-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-boost-1.91.0-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-ccache-4.13.2-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-clang-libs-22.1.4-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-clang-22.1.4-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-cmake-4.3.2-2-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-icu-78.3-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-llvm-libs-22.1.4-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-llvm-tools-22.1.4-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-llvm-22.1.4-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-tbb-2022.3.0-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-thrift-0.22.0-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-zstd-1.5.7-1-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-gflags-2.2.2-7-any.pkg.tar.zst" - "$base/mingw-w64-x86_64-aws-sdk-cpp-1.11.479-1-any.pkg.tar.zst" - ) - pacman -U --noconfirm "${urls[@]}" - name: Cache ccache uses: actions/cache@v5 with: From ab11d0588b96946dd553cad2cb5cbdd9a3db9144 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Fri, 8 May 2026 12:10:52 +0200 Subject: [PATCH 2/4] Re-trigger CI for new set of logs From 41e980b6fcf9ad029b4a3b028072307ea49bad92 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Mon, 11 May 2026 14:36:49 +0200 Subject: [PATCH 3/4] Add debug for #49958 bad_weak_ptr --- cpp/src/arrow/dataset/dataset_writer_test.cc | 31 ++++++++++++++++++++ cpp/src/arrow/dataset/file_test.cc | 31 ++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/cpp/src/arrow/dataset/dataset_writer_test.cc b/cpp/src/arrow/dataset/dataset_writer_test.cc index 45a36deccea..07501a4f231 100644 --- a/cpp/src/arrow/dataset/dataset_writer_test.cc +++ b/cpp/src/arrow/dataset/dataset_writer_test.cc @@ -18,9 +18,14 @@ #include "arrow/dataset/dataset_writer.h" #include +#include +#include +#include #include #include +#include #include +#include #include #include "arrow/array/builder_primitive.h" @@ -37,6 +42,32 @@ using namespace std::string_view_literals; // NOLINT +namespace { +[[noreturn]] void ArrowTerminateHandler() noexcept { + std::ostringstream tid; + tid << std::this_thread::get_id(); + std::fprintf(stderr, "\n=== std::terminate on thread %s ===\n", tid.str().c_str()); + if (auto eptr = std::current_exception()) { + try { + std::rethrow_exception(eptr); + } catch (const std::exception& e) { + std::fprintf(stderr, " type: %s\n what(): %s\n", typeid(e).name(), e.what()); + } catch (...) { + std::fprintf(stderr, " non-std exception\n"); + } + } else { + std::fprintf(stderr, " (no in-flight exception)\n"); + } + std::fflush(stderr); + std::_Exit(134); // do NOT abort() on MinGW — it can pop a WER dialog +} + +[[maybe_unused]] const auto kInstallTerminateHandler = [] { + std::set_terminate(ArrowTerminateHandler); + return 0; +}(); +} // namespace + namespace arrow { namespace dataset { namespace internal { diff --git a/cpp/src/arrow/dataset/file_test.cc b/cpp/src/arrow/dataset/file_test.cc index 2e2561203be..8d3f5985a9c 100644 --- a/cpp/src/arrow/dataset/file_test.cc +++ b/cpp/src/arrow/dataset/file_test.cc @@ -18,10 +18,15 @@ #include #include #include +#include +#include +#include #include +#include #include #include #include +#include #include #include @@ -49,6 +54,32 @@ namespace cp = arrow::compute; +namespace { +[[noreturn]] void ArrowTerminateHandler() noexcept { + std::ostringstream tid; + tid << std::this_thread::get_id(); + std::fprintf(stderr, "\n=== std::terminate on thread %s ===\n", tid.str().c_str()); + if (auto eptr = std::current_exception()) { + try { + std::rethrow_exception(eptr); + } catch (const std::exception& e) { + std::fprintf(stderr, " type: %s\n what(): %s\n", typeid(e).name(), e.what()); + } catch (...) { + std::fprintf(stderr, " non-std exception\n"); + } + } else { + std::fprintf(stderr, " (no in-flight exception)\n"); + } + std::fflush(stderr); + std::_Exit(134); // do NOT abort() on MinGW — it can pop a WER dialog +} + +[[maybe_unused]] const auto kInstallTerminateHandler = [] { + std::set_terminate(ArrowTerminateHandler); + return 0; +}(); +} // namespace + namespace arrow { using compute::ExecBatchFromJSON; From 33cfeeab922313dcdbbb7dcc85772b4306384dcd Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Mon, 11 May 2026 17:57:06 +0200 Subject: [PATCH 4/4] Add more debug for #49958 --- cpp/src/arrow/dataset/CMakeLists.txt | 11 ++++++++++ cpp/src/arrow/dataset/dataset_writer_test.cc | 21 ++++++++++++++++++++ cpp/src/arrow/dataset/file_test.cc | 21 ++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/cpp/src/arrow/dataset/CMakeLists.txt b/cpp/src/arrow/dataset/CMakeLists.txt index fa6875527db..b50a9229f91 100644 --- a/cpp/src/arrow/dataset/CMakeLists.txt +++ b/cpp/src/arrow/dataset/CMakeLists.txt @@ -181,6 +181,17 @@ add_arrow_dataset_test(scanner_test) add_arrow_dataset_test(subtree_test) add_arrow_dataset_test(write_node_test) +# Diagnostic for issue GH-49958: build two tests as C++23 with libstdc++ backend +# so the terminate handler prints stack +if(MINGW + AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU" + AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 14) + set_target_properties(arrow-dataset-dataset-writer-test arrow-dataset-file-test + PROPERTIES CXX_STANDARD 23) + target_link_libraries(arrow-dataset-dataset-writer-test PRIVATE stdc++exp) + target_link_libraries(arrow-dataset-file-test PRIVATE stdc++exp) +endif() + if(ARROW_CSV) add_arrow_dataset_test(file_csv_test) endif() diff --git a/cpp/src/arrow/dataset/dataset_writer_test.cc b/cpp/src/arrow/dataset/dataset_writer_test.cc index 07501a4f231..08ac2cdd968 100644 --- a/cpp/src/arrow/dataset/dataset_writer_test.cc +++ b/cpp/src/arrow/dataset/dataset_writer_test.cc @@ -27,6 +27,11 @@ #include #include #include +#include +#if defined(__MINGW32__) && defined(__cpp_lib_stacktrace) +# include +# define ARROW_TEST_HAVE_STACKTRACE 1 +#endif #include "arrow/array/builder_primitive.h" #include "arrow/dataset/file_ipc.h" @@ -59,6 +64,22 @@ namespace { std::fprintf(stderr, " (no in-flight exception)\n"); } std::fflush(stderr); + +#ifdef ARROW_TEST_HAVE_STACKTRACE + std::fprintf(stderr, "Stack trace:\n"); + std::fflush(stderr); + try { + for (const auto& frame : std::stacktrace::current(/*skip=*/1)) { + std::fprintf(stderr, " %s\n", std::to_string(frame).c_str()); + std::fflush( + stderr); // per-frame flush so a mid-trace crash still leaves frames 0..N-1 + } + } catch (...) { + std::fprintf(stderr, " \n"); + } +#endif + + std::fflush(stderr); std::_Exit(134); // do NOT abort() on MinGW — it can pop a WER dialog } diff --git a/cpp/src/arrow/dataset/file_test.cc b/cpp/src/arrow/dataset/file_test.cc index 8d3f5985a9c..61422965451 100644 --- a/cpp/src/arrow/dataset/file_test.cc +++ b/cpp/src/arrow/dataset/file_test.cc @@ -28,6 +28,11 @@ #include #include #include +#include +#if defined(__MINGW32__) && defined(__cpp_lib_stacktrace) +# include +# define ARROW_TEST_HAVE_STACKTRACE 1 +#endif #include #include @@ -71,6 +76,22 @@ namespace { std::fprintf(stderr, " (no in-flight exception)\n"); } std::fflush(stderr); + +#ifdef ARROW_TEST_HAVE_STACKTRACE + std::fprintf(stderr, "Stack trace:\n"); + std::fflush(stderr); + try { + for (const auto& frame : std::stacktrace::current(/*skip=*/1)) { + std::fprintf(stderr, " %s\n", std::to_string(frame).c_str()); + std::fflush( + stderr); // per-frame flush so a mid-trace crash still leaves frames 0..N-1 + } + } catch (...) { + std::fprintf(stderr, " \n"); + } +#endif + + std::fflush(stderr); std::_Exit(134); // do NOT abort() on MinGW — it can pop a WER dialog }