temporalio / temporalio/sdk-java

WorkflowClient#execute doesn't pair correctly with workflowStub.getResult()

Open
#856 1 comment 0 reactions 1 assignee View on GitHub

@tsurdilo is already working on this.

Since Jan 21, 2022.

bug
Dominant language
Java
Stars
433
Forks
249
Avg merge
5d 6h
Merged PRs (30d)
26

Description

Actual behavior

https://github.com/Spikhalskiy/java-sdk/commit/40c0d626e0ea4778a956e388d33754e67bde23a8#diff-7cfba47d2337ff3ee746b09a4d916e5e839f9b8bff45a26e588727667437c160R94

  @Test
  public void executeAndGetResultFromStub() throws InterruptedException, ExecutionException {
    TestNoArgsWorkflowProc stubP =
        testWorkflowRule.newWorkflowStubTimeoutOptions(TestNoArgsWorkflowProc.class);
    WorkflowStub workflowStub = WorkflowStub.fromTyped(stubP);
    CompletableFuture<Void> executeCF = WorkflowClient.execute(stubP::proc);

    // This test hangs (times out), but uncommenting of either if these two lines makes it
    // pass, which doesn't make much sense
    // sleep(1000);
    // executeCF.get();
    workflowStub.getResult(Void.class);
  }

This unit test for a trivial workflow, that finishes immediately, hangs.
Uncommenting on either sleep or waiting for a completable future makes it pass.
Replacing execute with start (that returns WorkflowExecution) also makes this test pass.

Expected behavior

The test passes.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.