Skip to content

Fix TSan data race in WorkloadResourceManager deleteNode - #96270

Merged
alexey-milovidov merged 1 commit into
masterfrom
fix-scheduler-cpu-preemptive-tsan
Feb 8, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
fix-scheduler-cpu-preemptive-tsan

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Feb 7, 2026 •

Copy link
Copy Markdown
Member

Move the node shared_ptr into the executeInSchedulerThread lambda so that the UnifiedSchedulerNode is destroyed in the scheduler thread rather than the control thread. Previously, the local shared_ptr copy could become the last reference, and when it went out of scope on the control thread after the lambda erased the node from the map, the destructor would race with the scheduler thread that may still process activations (e.g. removeChild writing child_active vs activateChild reading it).

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Version info

  • Merged into: 26.2.1.406

Move the `node` shared_ptr into the `executeInSchedulerThread` lambda
so that the `UnifiedSchedulerNode` is destroyed in the scheduler thread
rather than the control thread. Previously, the local shared_ptr copy
could become the last reference, and when it went out of scope on the
control thread after the lambda erased the node from the map, the
destructor would race with the scheduler thread that may still process
activations (e.g. `removeChild` writing `child_active` vs `activateChild`
reading it).

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Feb 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0de92a3]

Summary: ❌

job_name test_name status info comment
Stress test (amd_debug) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6) FAIL cidb, issue
Stress test (amd_tsan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-2da1) FAIL cidb, issue
Stress test (arm_asan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6) FAIL cidb, issue
Stress test (amd_msan) failure
Logical error: Block structure mismatch in A stream: different number of columns: (STID: 0993-38e6) FAIL cidb, issue
AST fuzzer (arm_asan) failure
Logical error: Expected JOIN table expression to be table, table function, query or union node. Actual A (STID: 0250-28ff) FAIL cidb

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Feb 7, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Looks very reasonable.

@alexey-milovidov alexey-milovidov self-assigned this Feb 8, 2026
@alexey-milovidov
alexey-milovidov merged commit 373d157 into master Feb 8, 2026
125 of 130 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-scheduler-cpu-preemptive-tsan branch February 8, 2026 01:56
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 8, 2026
@serxa serxa self-assigned this Mar 13, 2026
@serxa

serxa commented Mar 13, 2026

Copy link
Copy Markdown
Member

Actually fixed here #97372

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

Labels

post-approved Approved, but after the PR is merged. pr-ci 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.

3 participants