Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions cpp/src/arrow/dataset/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
52 changes: 52 additions & 0 deletions cpp/src/arrow/dataset/dataset_writer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,20 @@
#include "arrow/dataset/dataset_writer.h"

#include <chrono>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <mutex>
#include <optional>
#include <sstream>
#include <thread>
#include <typeinfo>
#include <vector>
#include <version>
#if defined(__MINGW32__) && defined(__cpp_lib_stacktrace)
# include <stacktrace>
# define ARROW_TEST_HAVE_STACKTRACE 1
#endif

#include "arrow/array/builder_primitive.h"
#include "arrow/dataset/file_ipc.h"
Expand All @@ -37,6 +47,48 @@

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);

#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, " <stacktrace unavailable>\n");
}
#endif

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 {
Expand Down
52 changes: 52 additions & 0 deletions cpp/src/arrow/dataset/file_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@
#include <arrow/compute/function.h>
#include <arrow/compute/registry.h>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <exception>
#include <memory>
#include <sstream>
#include <string>
#include <thread>
#include <tuple>
#include <typeinfo>
#include <vector>
#include <version>
#if defined(__MINGW32__) && defined(__cpp_lib_stacktrace)
# include <stacktrace>
# define ARROW_TEST_HAVE_STACKTRACE 1
#endif

#include <gmock/gmock.h>
#include <gtest/gtest.h>
Expand All @@ -49,6 +59,48 @@

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);

#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, " <stacktrace unavailable>\n");
}
#endif

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;
Expand Down
Loading