Skip to content

GH-47124: [C++][Dataset] Fix DatasetWriter deadlock on concurrent WriteRecordBatch #47129

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

gitmodimo
Copy link
Contributor

@gitmodimo gitmodimo commented Jul 17, 2025

Rationale for this change

Throttle is accessed twice - once in Acquire and again using future. As a result current_value_ may not be increased due to throttle being applied and shorty after the returned future may become finished. That leads to issue described in #47124

backpressure =
writer_state_->rows_in_flight_throttle.Acquire(next_chunk->num_rows());
if (!backpressure.is_finished()) {

What changes are included in this PR?

Change throttle API to return optional (akin to ThrottledAsyncTaskScheduler ::Throttle) and prevent race.

Are these changes tested?

Yes

Are there any user-facing changes?

No

Copy link

⚠️ GitHub issue #47124 has been automatically assigned in GitHub to PR creator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant