Child Workflow waiting for PArent workflow to finish a certain activity before starting


I am trying to use signals in temporal to pause execution of child workflow until certain activity in parent workflow has finished.

I tried using something like this in parent workflow to signal the child Workflow. I call this only after a certain activity in the parent, say ReportId.

The child workflow has this waiting for the signal from parent.

I see child workflow running even ReportId activity is still running… is the understanding that the child workflow would wait until the parent sends the signal flawed?

Start troubleshooting by looking at both the parent and child workflow event histories. They will give you the exact idea about what happened. Was the signal sent before the activity was completed? Did the child receive the signal, etc.

Thanks @maxim ! The child workflow completed even before the signal form the parent workflow could be triggered.

So i think I don’t understand how signals work.

Say i define a ChildWorkflow with the following block before any activity execution starts, does it not mean the workflow would wait for the signal to proceed? Should i be listening to the signal in an activity or a loop to block the workflow until i get the signal?

 var signal MySignal
 signalChan := workflow.GetSignalChannel(ctx, "your-signal-name")
 signalChan.Receive(ctx, &signal)

I see this reply asking to run signalChan.Receive() in a loop.

I tried using a timer for the same, but got a deadlock error. Looking into the same :slight_smile:

The posted code should block on Receive until the signal is received. So something else is going on. Could you post the parent and the child histories?

Hi @maxim Thanks for the response :slight_smile:

The code worked without the loop.
I think my initial tests has some other issues that prevented it from working.

1 Like