Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARROW-12668: [C++][Dataset] Fix segfault in CountRows #10259

Closed
wants to merge 1 commit into from

Conversation

lidavidm
Copy link
Member

@lidavidm lidavidm commented May 6, 2021

The code was obviously incorrect before. This change avoids 1) capturing a variable by reference and 2) mutating a non-thread-safe variable concurrently.

@github-actions
Copy link

github-actions bot commented May 6, 2021

Copy link
Member

@westonpace westonpace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, is the test case related though? It think it's a good case to have but just want to check my understanding.

@lidavidm
Copy link
Member Author

lidavidm commented May 6, 2021

LGTM, is the test case related though? It think it's a good case to have but just want to check my understanding.

Yes - the test case, with the old code, would cause a use-after-free (since the callback in CountRows would run and try to append to a vector on the stack which doesn't exist anymore). I decided I couldn't capture the original failure effectively in a unit test (two callbacks run concurrently and interleave their calls to push_back) but both are symptoms of the same thing (don't take shared state by reference and then try to use it concurrently!).

@lidavidm lidavidm closed this in 43a9dae May 6, 2021
michalursa pushed a commit to michalursa/arrow that referenced this pull request Jun 13, 2021
The code was obviously incorrect before. This change avoids 1) capturing a variable by reference and 2) mutating a non-thread-safe variable concurrently.

Closes apache#10259 from lidavidm/arrow-12668

Authored-by: David Li <li.davidm96@gmail.com>
Signed-off-by: David Li <li.davidm96@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants