temporalio / temporalio/sdk-java

Duplicate concurrent workflow - hangs on completion

Open
#456 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Expected Behavior

I start 2 workflows (one by one) with the same workflowId and WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE option.
I use execute method to start exection.

First workflow is still running when I start the second - so the second should just becomes a "proxy" for the first one and should return the same result without starting a new wf instance.

Then I try to wait for CompletableFuture and get the result.
Pseudo-code for illustration:

f1 = WorkflowClient.execute(..., options)
f2 = WorkflowClient.execute(..., options)
result1 = f1.get()
result2 = f2.get()

The behaviour is very different when I use Test Environment and real docker containers for Temporal.
With "real" Temporal all works as expected.
I expect that in the test environment it works the same way.

Actual Behaviour

With Test Environment the second f2.get() call hangs forever.

If the first workflow is fully completed before starting the second, all works OK.

Steps to Reproduce the Problem

I have a test (implemented in Kotlin) that fully reproduces the described issue. See the attached file.
DuplicateWorkflowIdTest.kt.zip

Specifications

  • Version: Java SDK 1.0.7, Temporal 1.8.2
  • Platform: Java SDK 1.0.7, Kotlin

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.

Research direction

Start with the attached DuplicateWorkflowIdTest.kt reproduction and trace the two concurrent WorkflowClient.execute calls using the duplicate workflow ID in the Test Environment. Compare its completion behavior with real Temporal containers; done means both f1.get() and f2.get() complete with the same result when the first workflow is still running.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.