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
The relevant definitions in record_batch.cc are below
const std::vector<std::shared_ptr<Array>>& columns() constoverride {
for (int i = 0; i < num_columns(); ++i) {
// Force all columns to be boxedcolumn(i);
}
return boxed_columns_;
}
std::shared_ptr<Array> column(int i) constoverride {
std::shared_ptr<Array> result = std::atomic_load(&boxed_columns_[i]);
if (!result) {
result = MakeArray(columns_[i]);
std::atomic_store(&boxed_columns_[i], result);
}
return result;
}
The columns() method returns a reference to mutable boxed_columns_, assuming that it is fully initialized and will not be written to again. However, multiple threads can race to initialize boxed_columns_[i], leading to additional atomic writes after column(i) has been called for the first time. These atomic writes can race against non atomic reads of the boxed_columns_ vector after it is returned by columns(). This is undefined behavior and can lead to a use-after-free of the contained Arrays.
Component(s)
C++
The text was updated successfully, but these errors were encountered:
Describe the bug, including details regarding any error messages, version, and platform.
The following example test case, when run under TSAN, reports a data race.
The relevant definitions in
record_batch.cc
are belowThe
columns()
method returns a reference tomutable boxed_columns_
, assuming that it is fully initialized and will not be written to again. However, multiple threads can race to initializeboxed_columns_[i]
, leading to additional atomic writes aftercolumn(i)
has been called for the first time. These atomic writes can race against non atomic reads of theboxed_columns_
vector after it is returned bycolumns()
. This is undefined behavior and can lead to a use-after-free of the containedArray
s.Component(s)
C++
The text was updated successfully, but these errors were encountered: