getResultAsync doesn't return if the child workflow timed out OR getResultAsync with timeout provided

My use case is: ParentWorkflow creates and starts retryable ChildWorkflow async, I want to get the execution result of the ChildWorkflow async when the ChildWorkflow completed or timed out (workflowExecutionTimeout reached)

Method #1
This code works fine if the ChildWorkflow completed; i.e., ChildWorkflow returns a value (even after exception thrown once and it’s retried):

WorkflowStub childWorkflowStub = workflowClient.newUntypedWorkflowStub(childWorkflowId);
                result -> {
        "getResultAsync: " + result);
                  return result;

However, no result if the ChildWorkflow failed with exception thrown and no value returned.

Method #2
I try getResultAsync with timeout provided but I also don’t get any result/exception.

Is this known issue or not expected?

I can upload the sample program is needed.

Hi @patrick

getResultAsync will return a value when the workflow is completed.

For failed workflows, your code should throw an exception. You can catch it with exceptionally

              result2 -> {
                System.out.println("Result2: " + result2);
                return result2;
              ex -> {
                System.out.println("Exception: " + ex);
                return "ex";

There is an example you can play with in the samples-java repo samples-java/ at main · temporalio/samples-java · GitHub

Please feel free to share your code so we can try to reproduce this.

Thank you,