[C++] Potential race condition in readahead generator
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 91
Description
It is possible for the final future to get marked finished twice.
Thread 1: Polls the generator, checks finished (false), is about to add a task
Thread 2: Finishes, marks finished, decrements running tasks to 0
Thread 1: adds task, immediately finishes, decrements running tasks to 0
Both threads will attempt to mark the final future finished.
**Reporter**: [Weston Pace](https://issues.apache.org/jira/browse/ARROW-17996) / @westonpace
**Note**: *This issue was originally created as [ARROW-17996](https://issues.apache.org/jira/browse/ARROW-17996). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*
Contributor guide
Research direction
No file or test is named. Locate the C++ readahead generator and inspect the final-future completion path, then reason through or reproduce the two-thread interleaving described. Done means concurrent completion cannot mark the final future finished twice, with a regression test covering the race.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100