# Deadlock when Childstep has Input property

**URL:** <https://forum.opentap.io/t/deadlock-when-childstep-has-input-property/654>\
**Category:** Technical\
**Tags:** plugin\
**Created:** [April 19, 2022, 6:50pm UTC](https://forum.opentap.io/t/deadlock-when-childstep-has-input-property/654 "2022-04-19T18:50:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![priram](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@priram](https://forum.opentap.io/u/priram)\
**Post date:** [April 19, 2022, 6:50pm UTC](https://forum.opentap.io/t/deadlock-when-childstep-has-input-property/654/1 "2022-04-19T18:50:19Z")

</div>

Hi,

I am running into deadlock when I have a Parent with an Output Attribute and a child that is specified as an input. When executing the plan, it results in a deadlock. Why?

2022-04-19 14:34:26.544916 ; TestPlan ; Error ; Error running “???”: Deadlock detected.  
2022-04-19 14:34:26.546832 ; TestPlan ; Debug ; Exception: Deadlock detected  
2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.TestStepRun.WaitForOutput(OutputAvailability mode)  
2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.InputOutputRelation.GetOutput(IMemberData outputMember, Object outputObject)  
2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.InputOutputRelation.UpdateInputs(ITestStepParent target)  
2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.TestStepExtensions.DoRun(ITestStep Step, TestPlanRun planRun, TestRun parentRun, IEnumerable`1 attachedParameters) 2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.TestStepExtensions.RunChildSteps(ITestStep Step, TestPlanRun currentPlanRun, TestStepRun currentStepRun, IEnumerable`1 attachedParameters, CancellationToken cancellationToken)  
2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.TestStep.RunChildSteps(IEnumerable`1 attachedParameters, CancellationToken cancellationToken) 2022-04-19 14:34:26.563787 ; TestPlan ; Debug ; at OpenTap.TestStep.RunChildSteps(IEnumerable`1 attachedParameters)

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [April 19, 2022, 7:26pm UTC](https://forum.opentap.io/t/deadlock-when-childstep-has-input-property/654/2 "2022-04-19T19:26:27Z")

</div>

Hi @priram,

How did you configure this test step? I think the GUI should not allow you to get into this situation.

What happens is that your child step is waiting for the parent to finish in order for the output to be ready. So this is guaranteed to be a dead-lock situation. That is because we assume that the output is being set during parent.Run() and the only safe conclusion is that it is set after Run() completes. To fix this, you can use OutputAttribute to more specifically define when the output value becomes available.

This is done using the OutputAvailability attribute, which is defined like this:

```csharp
  public enum OutputAvailability
    {
        /// <summary> The output value is available before the step has run. This can also be interpreted as always available. </summary>
        BeforeRun,
        /// <summary> After this step is completed. This may occur before or after AfterChildDefer. </summary>
        AfterRun,
        /// <summary> After defer of this step. This is the default for Outputs. This occurs after 'AfterChildDefer' and 'AfterRun'. </summary>
        AfterDefer 
    }

```

So use `[Output(OutputAvailability.BeforeRun)]` to make the output available to child steps at any time.

---

<div class="post-metadata">

**Author:** ![priram](https://avatars.discourse-cdn.com/v4/letter/p/e8c25b/32.png) [@priram](https://forum.opentap.io/u/priram)\
**Post date:** [April 19, 2022, 7:53pm UTC](https://forum.opentap.io/t/deadlock-when-childstep-has-input-property/654/3 "2022-04-19T19:53:16Z")

</div>

Hi @rolf_madsen ,

Thank you. After I specified the output attribute to be BeforeRun, it worked fine.

I was accessing the output attribute in the child step Run to read the value and hence the issue because of the default attribute.

---

<div class="post-metadata">

**Author:** ![davihous](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@davihous](https://forum.opentap.io/u/davihous)\
**Post date:** [July 6, 2023, 11:33pm UTC](https://forum.opentap.io/t/deadlock-when-childstep-has-input-property/654/4 "2023-07-06T23:33:17Z")

</div>

I am having the same issue described above, but I am not able to fix it by adding an OutputAvailability attribute. I am working in python, and this is what I have for my parameter:

param1 = property(String, None).add\_attribute(OpenTap.Output(OpenTap.OutputAvailability.BeforeRun))
