You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug, including details regarding any error messages, version, and platform.
Status: Resolved (May 16). Root cause was GCC bug 125312 15.2->16.1 regression in MinGW's libstdc++.dll (non-inline __exchange_and_add used by atomic shared_ptr ref-counting). Not an Arrow bug.
Fix shipped via MSYS2 rebuild msys2/MINGW-packages#29502 with release 4 mingw-w64-x86_64-gcc-libs-16.1.0-4.
On AMD64 Windows MinGW MINGW64 C++ with MSYS2 gcc 15.2 -> 16.1 update (post 2026 April 30: mingw-w64-x86_64-gcc-16.1.0-3 and mingw-w64-x86_64-gcc-libs) two tests started failing every run with std::bad_weak_ptr: arrow-dataset-dataset-writer-test and arrow-dataset-file-test. Also affected, with no dataset code involved: arrow-async-utility-test (heap corruption in PushGenerator.Stress), arrow-threading-utility-test (Timeout), ... CLANG64 C++ (libc++) and gcc 15.2 are unaffected!
[ RUN ] TestFileSystemDataset.MultiThreadedWritePersistsOrder
terminate called after throwing an instance of 'std::bad_weak_ptr'
what(): bad_weak_ptr
...
[ RUN ] DatasetWriterTestFixture.BatchWriteConcurrent
terminate called after throwing an instance of 'std::bad_weak_ptr'
what(): bad_weak_ptr
Diagnosed further - this isn't a dataset_writer bug. It looks like lower-level memory corruption, likely a gcc-16/MinGW regression. Keeping workaround of #49931's MSYS2 pin for now, #49945 stays waiting, tracked under #49948.
The bad_weak_ptr isn't an Arrow lifetime bug: in BatchWriteConcurrent the queue's only shared_ptr is not reset until Finish(), so weak_from_this().expired() there means a corrupted control block. reset -> make_shared did not fix this.
Test #62: arrow-dataset-dataset-writer-test ............Exit code 0xc0000374***Exception: 0.30 sec
...
Test #62: arrow-dataset-dataset-writer-test ............ Passed 4.85 sec
...
The following tests FAILED:
41 - arrow-async-utility-test (Exit code 0xc0000374) arrow-tests unittest
44 - arrow-threading-utility-test (Timeout) arrow-tests unittest
65 - arrow-dataset-file-test (Failed) arrow_dataset unittest
78 - arrow-flight-test (Failed) arrow_flight unittest
Error: Process completed with exit code 8.
Independent reproducers without dataset_writer are: arrow-async-utility-test always dies at PushGenerator.Stress and arrow-threading-utility-test always times out. Both fine on CLANG64/libc++ and on gcc‑15.2. Only gcc 15.2->gcc 16.1 is affected.
changed the title [-][C++][Dataset] std::bad_weak_ptr in multi-threaded writer tests on MinGW gcc-16[/-][+][C++][CI] MinGW Gcc 15.2->16.1 toolchain regression - memory corruption in multi-threaded tests[/+]on May 12, 2026
Thanks for debugging this. If this is a MinGW GCC 16.1 problem, it's better that we report it to the upstream. Can we create a (small) program code that reproduces this?
Activity
Add debug for apache#49958 bad_weak_ptr
Add more debug for apache#49958
Bypass MSYS2 gcc-16 nodejs in Apollo Windows job
tadeja commentedon May 12, 2026
Cross-posting from pr for visibility:
[-][C++][Dataset] std::bad_weak_ptr in multi-threaded writer tests on MinGW gcc-16[/-][+][C++][CI] MinGW Gcc 15.2->16.1 toolchain regression - memory corruption in multi-threaded tests[/+]kou commentedon May 12, 2026
Thanks for debugging this. If this is a MinGW GCC 16.1 problem, it's better that we report it to the upstream. Can we create a (small) program code that reproduces this?
docs(building): drop MSYS2 nodejs from Windows deps to avoid gcc-16 b…
tadeja commentedon May 14, 2026
@kou I've reported upstream gcc - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125312
I have repro set of CI logs listed in comment from yesterday and with more debug from today.
Maybe we could open an issue also in MINGW-packages for posterity (this example issue got closed immediately).
kou commentedon May 14, 2026
Great! Thanks!
[-][C++][CI] MinGW Gcc 15.2->16.1 toolchain regression - memory corruption in multi-threaded tests[/-][+][C++][CI] MinGW GCC 16.1 regression - shared_ptr corruption in multi-threaded tests[/+]tadeja commentedon May 15, 2026
GCC 125312 findings related fix already merged in upstream MSYS2 msys2/MINGW-packages#29502, so Revision 4 available soon - https://packages.msys2.org/packages/mingw-w64-x86_64-gcc-libs shows
kou commentedon May 15, 2026
Great!!!
GH-49948: [CI][C++] Revert PR 49931 (Pin MinGW MSYS2 packages) but ke…
tadeja commentedon May 19, 2026
Closing as resolved by gcc#125312 -> msys2/MINGW-packages#29502 (merged May 15) and then #49945 (merged May 16).
Arrow tests now pass on current MSYS2: https://github.com/apache/arrow/actions/runs/25937291262/job/76296127141#step:5:109
Thanks @kou for the nudge to take this upstream!
apacheGH-49948: [CI][C++] Revert PR 49931 (Pin MinGW MSYS2 packages) …