Repository navigation
Conversation
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
Contributor
Tests PassedCommit: 3644fea |
lukesandberg
approved these changes
Oct 20, 2026
Contributor
|
Some benchmarking results would be nice but are difficult. im guessing this saves executing dead tasks which isn't that common... maybe? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
invalidate_cell_dependentsin turbo-tasks-backend no longer dirties a dependent task when none of the invalidated dependency keys are still current or outdated dependencies of that task.Why?
A cell's dependents are collected while the cell task is locked, and each dependent is locked separately afterwards. In between, the dependent can finish an execution that no longer reads the cell, and
cleanup_old_edgesremoves the dependency. For hashed cells, the dependent may also track only other keys of the same cell.The code was meant to skip such removed dependencies, but its
continueonly continued the inner per-key loop. So the task was always marked dirty and rescheduled after the loop, even when every key had been removed.Follow-up to #100446 (comment).
How?
Every key is a separate dependency. Keys are only grouped per dependent to reduce task locking, so the decision is made per task after all keys have been checked:
The task is only dirtied if at least one key is outdated or current. Installing the new cell content, notifying waiters, and processing the aggregation queue happen regardless.
The race can't be triggered reliably through the public turbo-tasks API, so this adds backend unit tests that set up dependency state directly and call
invalidate_cell_dependents. They cover:Verification
cargo test -p turbo-tasks-backendcargo test -p turbo-tasks-backend --lib --features task_dirty_cause invalidate_cell_dependents_testscargo clippy -p turbo-tasks-backend --tests