pulumi/pkg/engine
Fraser Waters 0ab7f9e8bd
Deepcopy event payloads on construction _not_ on access (#14049)
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/14036.

Not sure this is perfect (it's pretty hard to reason about mutation of
the whole system given what Go gives us to work with), but it seems
better.

We copy event payloads on construction, which should be synchronous with
step execution, rather than on access which could be in parallel with
the step executor or deployment executor mutating resource state.

Just copying on construction flagged up that the deployment executor and
step executor both race to modify resource state when the deployment
executor starts scheduling deletes. We add a synchronisation point
between the two parts in this change so that the deployment executor
waits for the step executor to go quite, and keeps it quite while it
computes the deletes, once it starts scheduling them the step executor
can run again.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-10-02 14:15:10 +00:00
..
lifecycletest ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
deployment.go ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
deployment_test.go ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
destroy.go ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
detailedDiff.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
detailedDiff_test.go [display] Refactor diff translation and display. (#9363) 2022-04-07 12:05:33 -07:00
doc.go Document Go packages (#6009) 2021-01-11 11:07:59 -07:00
engine.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
errors.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
events.go Deepcopy event payloads on construction _not_ on access (#14049) 2023-10-02 14:15:10 +00:00
events_test.go Do not panic when sending events to closed emitter (#10489) 2022-08-25 12:43:10 -04:00
eventsink.go chore: WriteString(Sprintf(..)) => Fprintf(..) 2023-03-01 13:22:33 -08:00
import.go Move sdk/go/common/display to /pkg/display (#13954) 2023-09-18 11:01:28 +00:00
journal.go Fix engine.Journal to not write out skipped creates 2023-07-21 16:26:40 +01:00
plugin_host.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
plugins.go Pass provider checksums in requests and save to state (#13789) 2023-09-11 15:54:07 +00:00
plugins_test.go all: Reformat with gofumpt 2023-03-03 09:00:24 -08:00
project.go Update error handling (#8406) 2021-11-12 18:37:17 -08:00
query.go ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
refresh.go ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
snapshot.go [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
update.go ctrl-c should cause Pulumi to call Cancel operation on providers (#14057) 2023-09-29 22:12:35 +00:00
update_test.go [display] fix ComponentResource deletion not stopping time elapsed timer (#14061) 2023-09-29 19:48:33 +00:00