Skip to content

Fix TSan data race in Parquet reader - #106000

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
azat:fix-parquet-v3-exception-race
May 30, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
azat:fix-parquet-v3-exception-race

Conversation

@azat

@azat azat commented May 27, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix TSan data race in Parquet reader

Parquet::ReadManager::runBatchOfTasks() can mutate exception, while Prefetcher::runTask() may rethrow the same exception, and so runBatchOfTasks() may have a data-race

TSan report - https://pastila.nl/?003169db/e279818b622dcecc6ea34bdbbecc2504#9p8Zaqb6CrjGOd9QAF8JjA==GCM

Version info

  • Merged into: 26.6.1.261

@clickhouse-gh

clickhouse-gh Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f6025e3]

Summary: ✅


AI Review

Summary

This PR replaces shared rethrow of task->exception in Prefetcher with copyMutableException(task->exception), so concurrent waiters no longer mutate the same Poco/DB::Exception instance via addMessage. The change is minimal, consistent with the existing pattern in ReadManager, and does not introduce unresolved correctness or safety issues.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label May 27, 2026
Parquet::ReadManager::runBatchOfTasks() can mutate exception, while
Prefetcher::runTask() may rethrow the same exception, and so
runBatchOfTasks() may have a data-race

TSan report - https://pastila.nl/?003169db/e279818b622dcecc6ea34bdbbecc2504#9p8Zaqb6CrjGOd9QAF8JjA==GCM
@azat
azat force-pushed the fix-parquet-v3-exception-race branch from 8adcc24 to f6025e3 Compare May 27, 2026 19:00
@clickhouse-gh

clickhouse-gh Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.10% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.50% -0.10%

Changed lines: 33.33% (1/3) · Uncovered code

Full report · Diff report

@Algunenano Algunenano self-assigned this May 28, 2026

@Algunenano Algunenano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good. I was thinking we might need to use this in some other places, because I remember we had to fix something like this in the past, but it looks like at least fibers don't need it right now. So it's all fine

@alexey-milovidov alexey-milovidov self-assigned this May 30, 2026
@alexey-milovidov
alexey-milovidov merged commit 3288e8d into ClickHouse:master May 30, 2026
165 of 166 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants