Repository navigation
Synchronize in-flight call draining on Exec.Finalize (fixes #470) - #471
Merged
Merged
Conversation
… model.Exec. Documented the lower-level graph.Finalize() that the user is responsible for waiting for all executions to finish. See discussion in issue #470.
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.
This PR resolves #470 by synchronizing in-flight execution and compilation draining when
Finalize()is called ongraph.Execandmodel.Exec.Changes
graph.Exec:finalized atomic.BoolandmuInFlight sync.RWMutexto coordinate execution draining with teardown.ErrExecFinalized, returned with stack-trace whenever operations are attempted on a finalized executor.CompileandcompileAndExecute(which backsCall,CallWithGraph,MustCall, etc.):finalized.Load()is true.muInFlight.RLock(); defermuInFlight.RUnlock().finalized.Load()to catch straddlers.Finalize():finalizedviaSwap(true)(idempotent for multiple calls).muInFlight.Lock(), ensuring all in-flight calls and compilations finish before releasing cached graphs.model.Exec:finalized atomic.BoolandmuInFlight sync.RWMutexto protect model execution, variable collection, and compilation.model.ErrExecFinalized(aliased tograph.ErrExecFinalized).graph.Graph.Finalize()regarding caller responsibility for in-flight executions.ExecandFinalize().docs/CHANGELOG.md.TestExecFinalizetest suites in bothcore/graphandml/modelcovering basic idempotent finalization, deterministic concurrent call draining, deterministic concurrent compilation draining, and race stress testing across all backends.Fixes #470.