From f326b2159505bca09c8c5951f0e2a7e9ca87483a Mon Sep 17 00:00:00 2001 From: Carlos Guzman Date: Fri, 27 Feb 2026 16:17:19 -0600 Subject: [PATCH] fix: disable SDK-managed curl init/cleanup to prevent SIGSEGV on Linux shutdown When loaded as a shared library inside Python/HDF5, Aws::Http::CleanupHttp() segfaults at process exit because curl's global state is torn down before the HDF5 VOL terminate callback fires. Setting initAndCleanupCurl = false prevents the SDK from managing the curl lifecycle, which is already owned by the host process. --- CHANGELOG.md | 15 +++++++++++++++ lib/include/arraymorph/s3vl/initialize.h | 9 ++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a0949d6 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,15 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +## [Unreleased] + +> **⚠️ Pre-release** — API may change. Feedback welcome via [GitHub Issues](https://github.com/ICICLE-ai/ArrayMorph/issues). + +### Added +- **Python Package & API**: ArrayMorph is now available via `pip install arraymorph`. You can now dynamically configure AWS S3, Azure Blob Storage, or any S3-compatible endpoints directly from Python (`arraymorph.configure_s3(...)` and `arraymorph.configure_azure(...)`). +- **Pre-built Binaries**: Pre-compiled binaries of `lib_arraymorph` are now attached to GitHub releases for Linux (x86_64, aarch64) and macOS (Apple Silicon). +- **Expanded Documentation**: The README has been overhauled with comprehensive How-To guides, tutorials, and a detailed explanation of ArrayMorph's chunked storage model and async I/O. + +### Changed +- **Simplified Build System**: The build system has been revamped. It now leverages `uv` for Python environments and `vcpkg` for fetching C++ SDK dependencies, making building from source much smoother. diff --git a/lib/include/arraymorph/s3vl/initialize.h b/lib/include/arraymorph/s3vl/initialize.h index cc11cb7..2179cd3 100644 --- a/lib/include/arraymorph/s3vl/initialize.h +++ b/lib/include/arraymorph/s3vl/initialize.h @@ -28,9 +28,16 @@ inline herr_t S3VLINITIALIZE::s3VL_initialize_init(hid_t vipl_id) { // Aws::SDKOptions options; // Changed to use global sdk options for proper // shutdown g_sdk_options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Off; + // curl_global_init/cleanup is not re-entrant and must be called exactly once + // per process. Python (or another loaded library) may already own that + // lifecycle. Delegating HTTP init/cleanup to the SDK causes a double-free / + // use-after-free inside Aws::Http::CleanupHttp() at process exit, resulting + // in a SIGSEGV from the HDF5 VOL terminate callback. Disabling SDK-managed + // HTTP init/cleanup avoids the crash while leaving curl usable for the SDK. + g_sdk_options.httpOptions.initAndCleanupCurl = false; std::set_terminate([]() { _exit(0); - }); // Shutdown conflicts with Python's interpretor shutdown on MacOS. + }); // Shutdown conflicts with Python's interpreter shutdown on macOS. // Terminate handler catches this and exits cleanly. Aws::InitAPI(g_sdk_options); Logger::log("------ Init VOL");