mirror of https://github.com/pulumi/pulumi.git
5db1fcabeb
This is a follow-up to #11975 with a more permanent fix. The cause of the original data race was that some of the invocations accessed the configuration before the Configure RPC succeeded. Notably, there was a case where we had: doStuff(cfg) waitForConfiguration() doMoreStuff(cfg) The issue was fixed by simple re-ordering. waitForConfiguration() doStuff(cfg) doMoreStuff(cfg) However, it remains very easy to read the configuration before it's actually configured. It's only a matter of time before the same bug arises again. To fix this, we pull out the configuration into its own struct, and make it accessible only by calling a specific function. This separation is enforced by a promise-like object with a consumer (Await) and a producer (Fulfill) end. Any method that needs the configuration must wait for it with Await first. NOTE: Switching to this new method was straightforward for nearly all methods because they run after Configure. However, in local experiments, CheckConfig ran before Configure; DiffConfig looks like it might too. Both these methods did not have any "wait for configure" blockers like the other methods, but they **still used the incorrect configuration**. I've filled in default values (false) for the configuration parameters that they consumed before the provider was configured because that's what they were using anyway. Refs #11975, #11971 |
||
---|---|---|
.. | ||
analyzer.go | ||
analyzer_plugin.go | ||
check.go | ||
config_source.go | ||
context.go | ||
doc.go | ||
host.go | ||
host_server.go | ||
langruntime.go | ||
langruntime_plugin.go | ||
plugin.go | ||
plugin_test.go | ||
provider.go | ||
provider_plugin.go | ||
provider_plugin_test.go | ||
provider_server.go | ||
provider_server_test.go | ||
provider_test.go | ||
provider_unimplemented.go | ||
rpc.go | ||
rpc_rapid_test.go | ||
rpc_test.go |