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
{{ message }}
Repository navigation
[C++][CI] arrow-json-test segfaults occasionally on AMD64 Windows MinGW MINGW64 C++ job #49272
Describe the bug, including details regarding any error messages, version, and platform.
I've seen on several PRs the AMD64 Windows MinGW MINGW64 C++ segfault when running the following test:
The following tests FAILED:
84 - arrow-json-test (SEGFAULT) arrow-tests unittest
The error doesn't show much (obvious with a segfault):
Start 84: arrow-json-test
81/98 Test #84: arrow-json-test ..............................***Exception: SegFault 0.03 sec
Running main() from gmock_main.cc
[==========] Running 235 tests from 60 test suites.
[----------] Global test environment set-up.
[----------] 6 tests from ReaderTest
[ RUN ] ReaderTest.MultipleChunksParallel
Start 84: arrow-json-test
Test #84: arrow-json-test ..............................***Exception: SegFault 0.03 sec
Running main() from gmock_main.cc
[==========] Running 235 tests from 60 test suites.
[----------] Global test environment set-up.
[----------] 6 tests from ReaderTest
[ RUN ] ReaderTest.MultipleChunksParallel
Start 84: arrow-json-test
Test #84: arrow-json-test ..............................***Exception: SegFault 0.03 sec
Running main() from gmock_main.cc
[==========] Running 235 tests from 60 test suites.
[----------] Global test environment set-up.
[----------] 6 tests from ReaderTest
[ RUN ] ReaderTest.MultipleChunksParallel
After reviewing the repository, I found that the segfault in ReaderTest.MultipleChunksParallel is likely related to:
Implementation Approach:
The parallel chunk processing in cpp/src/arrow/json/reader.cc might have race conditions when multiple threads access shared resources
Check memory management in ThreadedTaskGroup usage within the JSON reader - potential use-after-free or improper synchronization
MinGW-specific thread handling differences compared to MSVC - review thread pool initialization and cleanup
Add mutex guards around shared state modifications in parallel parsing code
Verify proper lifetime management of chunked JSON buffers during concurrent reads
The intermittent nature and the fact it only fails on MinGW suggests platform-specific threading or memory alignment issues in the parallel reader implementation.
Could you please assign this issue to me? Does this approach sound reasonable, or am I missing something? Any specific areas in the JSON reader code I should prioritize?
The root cause is MinGW's __emutls TLS emulation racing during thread creation in the thread pool. The fix replaces thread_local with native Win32 TLS API (TlsAlloc/TlsGetValue/TlsSetValue) on MinGW.
@raulcd since you reported this, could you take a look when you get a chance?
Hi, could someone review this when you get a chance?
This fixes an intermittent MinGW CI segfault (#49272) that causes false failures across unrelated PRs. The fix is minimal, just replaces thread_local with Win32 TLS API on MinGW in thread_pool.cc to bypass a known __emutls race condition.
Thanks!
Activity
vanshaj2023 commentedon Feb 14, 2026
Hi @raulcd
I'd like to work on this issue.
After reviewing the repository, I found that the segfault in
ReaderTest.MultipleChunksParallelis likely related to:Implementation Approach:
cpp/src/arrow/json/reader.ccmight have race conditions when multiple threads access shared resourcesThreadedTaskGroupusage within the JSON reader - potential use-after-free or improper synchronizationThe intermittent nature and the fact it only fails on MinGW suggests platform-specific threading or memory alignment issues in the parallel reader implementation.
Could you please assign this issue to me? Does this approach sound reasonable, or am I missing something? Any specific areas in the JSON reader code I should prioritize?
Thanks!
apacheGH-49272: [C++][CI] Fix intermittent segfault in arrow-json-tes…
vanshaj2023 commentedon Feb 16, 2026
I've submitted a PR to fix this: #49297
The root cause is MinGW's
__emutlsTLS emulation racing during thread creation in the thread pool. The fix replacesthread_localwith native Win32 TLS API (TlsAlloc/TlsGetValue/TlsSetValue) on MinGW.@raulcd since you reported this, could you take a look when you get a chance?
apacheGH-49272: [C++][CI] Fix intermittent segfault in arrow-json-tes…
apacheGH-49272: [C++][CI] Fix intermittent segfault in arrow-json-tes…
vanshaj2023 commentedon Mar 5, 2026
Hi, could someone review this when you get a chance?
This fixes an intermittent MinGW CI segfault (#49272) that causes false failures across unrelated PRs. The fix is minimal, just replaces
thread_localwith Win32 TLS API on MinGW inthread_pool.ccto bypass a known__emutlsrace condition.Thanks!
apacheGH-49272: [C++][CI] Fix intermittent segfault in arrow-json-tes…
apacheGH-49272: Fix include ordering lint failure in thread_pool.cc
apacheGH-49272: Fix clang-format lint issues in thread_pool.cc
apacheGH-49272: Preserve GetLastError() around TlsGetValue() in MinGW…
apacheGH-49272: Include windows_compatibility.h in thread_pool_test
apacheGH-49272: Include windows_compatibility.h in thread_pool_test
apacheGH-49272: Include windows_compatibility.h in thread_pool_test
apacheGH-49272: Expand MinGW TLS comment with upstream GCC bug refere…
apacheGH-49272: Remove redundant SetLastError before fatal log
apacheGH-49272: Remove redundant ParseOptions default in regression test
apacheGH-49272: Inline regression test body, remove single-use helper
GH-49272: [C++][CI] Fix intermittent segfault in arrow-json-test with…
pitrou commentedon May 7, 2026
Issue resolved by pull request 49462
#49462
GH-49930: [CI][C++] Pin MinGW MSYS2 packages to unblock CI (#49931)
apacheGH-49272: [C++][CI] Fix intermittent segfault in arrow-json-tes…
apacheGH-49930: [CI][C++] Pin MinGW MSYS2 packages to unblock CI (apa…