Commits


Colin authored and GitHub committed 27900a6cb79
GH-45371: [C++] Fix data race in `SimpleRecordBatch::columns` (#45372) ### Rationale for this change GH-45371 ### What changes are included in this PR? Use `std::atomic_compare_exchange` to initialize `boxed_columns_[i]` so they are correctly written only once. This means that a reference to `boxed_columns_` is safe to read after each element has been initialized. ### Are these changes tested? Yes, there is a test case `TestRecordBatch.ColumnsThreadSafety` which passes under TSAN. ### Are there any user-facing changes? No **This PR contains a "Critical Fix".** Without this fix, concurrent calls to `SimpleRecordBatch::columns` could lead to an invalid memory access and crash. * GitHub Issue: #45371 Lead-authored-by: Colin Schultz <colin@chalk.ai> Co-authored-by: Colin <31864253+colin-r-schultz@users.noreply.github.com> Co-authored-by: Antoine Pitrou <antoine@python.org> Co-authored-by: Antoine Pitrou <pitrou@free.fr> Signed-off-by: Antoine Pitrou <antoine@python.org>