cadence-workflow / cadence-java-client

Java framework for Cadence Workflow Service
https://cadenceworkflow.io
Other
145 stars 110 forks source link

Workflow.sleep() got stuck when multiple workflows run at the same time #369

Closed iversonzpy closed 2 weeks ago

iversonzpy commented 5 years ago

I defined a workflow and try to perform some Workflow.sleep() in the logic. And I started a worker and tried to run the same workflow multiple times at the same time, and I got the error as follow. Is there something I used wrong? Thanks!

[ERROR]  Workflow task failure. startedEventId=14, WorkflowID=5317ff1f-6d4b-41b4-afd2-0a3e2371a0ab, RunID=14cc77f3-5c23-4536-8ed3-17016b3aad97. If see continuously the workflow might be stuck.
java.lang.IllegalStateException: ReplayDecider expects next event id at 12. History's previous started event id is 9
    at com.uber.cadence.internal.replay.ReplayDecider.decideImpl(ReplayDecider.java:381)
    at com.uber.cadence.internal.replay.ReplayDecider.decide(ReplayDecider.java:356)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.processDecision(ReplayDecisionTaskHandler.java:135)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.handleDecisionTaskImpl(ReplayDecisionTaskHandler.java:115)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.handleDecisionTask(ReplayDecisionTaskHandler.java:76)
    at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:258)
    at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:230)
    at com.uber.cadence.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:71)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
mfateev commented 5 years ago

Have you changed the code after the workflow has started? Could you reproduce the problem with the freshly created workflows? If you can, post here the instructions on how to reproduce the problem, please.