[dotnet] Add a lock around child resource manipulation (#5563)
[dotnet] Add a lock around child resource manipulation to prevent hashset concurrency issue Co-authored-by: Justin Van Patten <jvp@justinvp.com>
This commit is contained in:
parent
ceec3eac0f
commit
4f07891595
|
@ -57,6 +57,9 @@ CHANGELOG
|
|||
- [sdk/python] Fix ResourceOptions annotations and doc strings.
|
||||
[#5559](https://github.com/pulumi/pulumi/pull/5559)
|
||||
|
||||
- [sdk/dotnet] Fix HashSet concurrency issue.
|
||||
[#5563](https://github.com/pulumi/pulumi/pull/5563)
|
||||
|
||||
## 2.11.2 (2020-10-01)
|
||||
|
||||
- feat(autoapi): expose EnvVars LocalWorkspaceOption to set in ctor
|
||||
|
|
|
@ -151,7 +151,12 @@ namespace Pulumi
|
|||
{
|
||||
if (resource is ComponentResource)
|
||||
{
|
||||
AddTransitivelyReferencedChildResourcesOfComponentResources(resource.ChildResources, result);
|
||||
HashSet<Resource> childResources;
|
||||
lock (resource.ChildResources)
|
||||
{
|
||||
childResources = new HashSet<Resource>(resource.ChildResources);
|
||||
}
|
||||
AddTransitivelyReferencedChildResourcesOfComponentResources(childResources, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,7 +188,10 @@ namespace Pulumi
|
|||
if (options.Parent != null)
|
||||
{
|
||||
this._parentResource = options.Parent;
|
||||
this._parentResource.ChildResources.Add(this);
|
||||
lock (this._parentResource.ChildResources)
|
||||
{
|
||||
this._parentResource.ChildResources.Add(this);
|
||||
}
|
||||
|
||||
if (options.Protect == null)
|
||||
options.Protect = options.Parent._protect;
|
||||
|
|
Loading…
Reference in a new issue