pulumi / pulumi-dotnet

.NET support for Pulumi
Apache License 2.0
28 stars 25 forks source link

Setting both Parent and DependsOn to the same component causes hang #122

Open justinvp opened 1 year ago

justinvp commented 1 year ago

The following program hangs:

using System.Collections.Generic;
using Pulumi;

return await Deployment.RunAsync(() =>
{
   var parent = new ComponentResource("pkg:index:first", "first");
   var child = new ComponentResource(
      "pkg:index:second",
      "second",
      new ComponentResourceOptions
      {
         Parent = parent,
         DependsOn = new[]{ parent},
      }
   );

   // This would freeze before the fix.
   var custom = new CustomResource(
      "foo:bar:baz",
      "myresource",
      ResourceArgs.Empty,
      new CustomResourceOptions
      {
         Parent = child,
      }
   );

   // Export outputs here
   return new Dictionary<string, object?>
   {
      ["outputKey"] = "outputValue"
   };
});

More details in https://github.com/pulumi/pulumi/issues/12032

justinvp commented 1 year ago

I have a local fix. Interestingly, when run from a test (using mocks), the test does not hang. But a local program using pulumi up does.

justinvp commented 1 year ago

When addressing this, make sure more complex relationships also do not hang: https://github.com/pulumi/pulumi/issues/12736