Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

fix(dal): : synchronize graph access in dependent values updates#3488

Merged
si-bors-ng[bot] merged 1 commit intomainfrom
synchronize-dependent-values-update
Mar 29, 2024
Merged

fix(dal): : synchronize graph access in dependent values updates#3488
si-bors-ng[bot] merged 1 commit intomainfrom
synchronize-dependent-values-update

Conversation

@zacharyhamm
Copy link
Copy Markdown
Contributor

@zacharyhamm zacharyhamm commented Mar 29, 2024

The concurrency types used by the WorkspaceSnapshot to provide interior mutability in the tokio run time are not sufficient to prevent data races when operating on the same graph on different threads, since our graph operations are not "atomic" and the graph WILL end up being read from different threads while a write operation is still in progress if it is shared between threads for modification. For example after a node is added but before the edges necessary to place that node in the right spot in the graph.

A more general solution is needed to represent the concept of a "transaction" when mutating the graph, to prevent other readers from seeing incomplete graphs from in-progress write operations.

For now, we have added a lock to DependentValuesUpdate that ensures the portion of the update that gathers the inputs to a function acquires a read lock, (which is released as soon as the function is sent to the executor, so that we don't hold on to it while executing in veritech), while the portion of the update that updates the graph with the execution result acquires a write lock.

@github-actions github-actions Bot added the A-dal label Mar 29, 2024
The concurrency types used by the WorkspaceSnapshot to provide interior
mutability in the tokio run time are *not* sufficient to prevent data
races when operating on the same graph on different threads, since our
graph operations are not "atomic" and the graph *WILL* end up being read
from different threads while a write operation is still in progress if
it is shared between threads for modification. For example after a node
is added but *before* the edges necessary to place that node in the
right spot in the graph.

A more general solution is needed to represent the concept of a
"transaction" when mutating the graph, to prevent other readers from
seeing incomplete graphs from in-progress write operations.

For now, we have added a lock to `DependentValuesUpdate` that ensures
the portion of the update that gathers the inputs to a function acquires
a read lock, (which is released as soon as the function is sent to the
executor, so that we don't hold on to it while executing in veritech),
while the portion of the update that updates the graph with the
execution result acquires a write lock.

Co-Authored-By: Jacob Helwig <jacob@systeminit.com>
Co-Authored-By: Nick Gerace <nick@systeminit.com>
Co-Authored-By: Scott Prutton <scott@systeminit.com>
@zacharyhamm zacharyhamm force-pushed the synchronize-dependent-values-update branch from 8210f8b to 21813a7 Compare March 29, 2024 19:29
@zacharyhamm zacharyhamm changed the title fix(dal): synchronize dependent value update fix(dal): : synchronize graph access in dependent values updates Mar 29, 2024
@zacharyhamm
Copy link
Copy Markdown
Contributor Author

bors r+

@si-bors-ng
Copy link
Copy Markdown
Contributor

si-bors-ng Bot commented Mar 29, 2024

Build succeeded:

@si-bors-ng si-bors-ng Bot merged commit d32c071 into main Mar 29, 2024
@si-bors-ng si-bors-ng Bot deleted the synchronize-dependent-values-update branch March 29, 2024 19:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant