Skip to content

[C++] Potential race condition in readahead generator #33201

Closed

Description

@asfimport

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 / @westonpace

Note: This issue was originally created as ARROW-17996. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Oct 12, 2022

    @asfimport
    Author

    Weston Pace / @westonpace:
    This commit demonstrates the problem fairly easily (if running stress): master...westonpace:arrow:bugfix/ARROW-17996--race-condition-in-readahead-generator

  2. thisisnic commented on Nov 19, 2026

    @thisisnic
    Member

    This appears to have been fixed in #45954, which describes the samenterleaving: finished and num_running in ReadaheadGenerator are now updated under a single mutex, so the check and the increment can no longer be separated. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions