pulumi/sdk/python/lib/test
Justin Van Patten 5dd813ea47 [sdk/python] Fix hang due to component children cycles
When a resource depends on a local component resource, rather than setting the component resource itself as a dependency, each of the component's descendants is added as a dependency. This can lead to hangs when cycles are introduced.

For example, consider the following parent/child hierarchy, where `ComponentA` is the parent of `ComponentB` and `ComponentB` is the parent of `CustomC`:

ComponentA
    |
ComponentB
    |
 CustomC

If `ComponentB` specifies it has a dependency on `ComponentA`, the following takes place as part determining the full set of transitive dependencies:

1. `ComponentA`  is a component resource so it isn't added as a dependency, its children are.
2. `ComponentA` has one child: `ComponentB`
3. `ComponentB`  is a component resource so it isn't added as a dependency, its children are.
4. `ComponentB` has one child: `CustomC`, a custom resource.
5. Since `CustomC` is a custom resource, it is added to the set of dependencies.
6. We try to await its URN, but we'll never get it because `RegisterResource` hasn't yet been called for it. And we hang waiting.

To address this, skip looking at a component's children if it is the component from which the dependency is being added.

In the example, with the fix, at step 3 the dependency expansion will stop: we won't look at `ComponentB`'s children because we're adding the dependency from `ComponentB`.

PR feedback
2023-04-07 07:23:04 -07:00
..
automation Support WhoAmI in automation api for old CLI versions 2023-03-22 13:30:08 +00:00
data/lazy_import_test Fix issue with lazy_import affecting pulumi-eks (#7024) 2021-05-11 22:48:08 -04:00
langhost [sdk/python] Fix hang due to component children cycles 2023-04-07 07:23:04 -07:00
provider fix(sdk/python): Makes SETTINGS attributes context-aware (#10402) 2022-08-23 13:45:37 -04:00
runtime Exclude parentUrn when initlaizing Alias.Spec if no_parent is True 2023-01-30 18:11:29 +01:00
__init__.py Fix a couple of issues when projecting Protobuf and UNKNOWN in Python (#1468) 2018-06-06 16:09:07 -07:00
conftest.py feat: Supports optional arguments for pulumi.Config getters (#10344) 2022-08-11 10:21:46 -04:00
helpers.py Lower the BrokenDynamicProvider regression test from integration to mock (#7951) 2021-09-10 17:25:48 -04:00
test_broken_dynamic_provider.py ci: Fix Windows flake with longer timeout 2022-09-14 09:57:02 -07:00
test_monitor_termination.py ci: Fix Windows flake with longer timeout 2022-09-14 09:57:02 -07:00
test_next_serialize.py fix(sdk/python): Makes SETTINGS attributes context-aware (#10402) 2022-08-23 13:45:37 -04:00
test_output.py Handle Outputs in dict keys passed to from_input 2023-01-27 04:51:05 +00:00
test_resource.py [sdk/python] Fix hang due to component children cycles 2023-04-07 07:23:04 -07:00
test_runtime_to_json.py [sdk/python] Add pulumi.runtime.to_json utility (#5307) 2020-09-09 12:08:45 -07:00
test_stack_reference.py sdk/py/StackReference: Add get_output_details 2023-02-03 16:58:35 -08:00
test_stack_registers_outputs.py fix(sdk/python): Makes SETTINGS attributes context-aware (#10402) 2022-08-23 13:45:37 -04:00
test_translate_output_properties.py [sdk/python] - Support enums (#5615) 2020-11-24 19:15:11 -06:00
test_types_input_type.py [sdk/python] Fix pulumi.property's default value handling (#7736) 2021-08-11 09:15:46 -07:00
test_types_input_type_types.py [sdk/python] Improved dict key translation support (#6695) 2021-04-14 19:32:18 +01:00
test_types_output_type.py Python SDK changes to support input/output classes (#5033) 2020-08-19 01:15:56 -07:00
test_types_resource_types.py Python SDK changes to support input/output classes (#5033) 2020-08-19 01:15:56 -07:00
test_urn.py Satisfy Python lint: factor out URN parsing in Python and other fixes (#7821) 2021-08-24 09:57:51 -04:00
test_utils.py Fix issue with lazy_import affecting pulumi-eks (#7024) 2021-05-11 22:48:08 -04:00