Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-7510

[C++] Array::null_count() is not thread-compatible

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.16.0
    • Component/s: C++

      Description

      ArrayData has a mutable member null_count, that can be updated in a const function. However null_count is not atomic, so it's subject to data race.

       

      I guess Arrays are not thread-safe (which is reasonable), but at least they should be thread-compatible so that concurrent access to const member functions are fine.

      (The race looks "benign", but see [1][2])

      https://github.com/apache/arrow/blob/dbe708c7527a4aa6b63df7722cd57db4e0bd2dc7/cpp/src/arrow/array.cc#L123

       

      [1]https://software.intel.com/en-us/blogs/2013/01/06/benign-data-races-what-could-possibly-go-wrong

      [2]https://bartoszmilewski.com/2014/10/25/dealing-with-benign-data-races-the-c-way/

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                apitrou Antoine Pitrou
                Reporter:
                brillsp Zhuo Peng
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h