cadence-workflow / cadence-java-client

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

NonDeterministicWorkflowPolicy.FailWorkflow causes an exception to be thrown. #429

Closed ymironoff1 closed 2 weeks ago

ymironoff1 commented 4 years ago

pulled and built latest version of client.

    public class PipelineWorkflowImpl implements  PipelineWorkflow {
           @Override
           public void runPipeline(String configId) {
              ...
           }
       }

        final Worker workerForCommonTaskList = factory.newWorker(TASK_LIST);
        WorkflowImplementationOptions wio = new WorkflowImplementationOptions(NonDeterministicWorkflowPolicy.FailWorkflow);
        workerForCommonTaskList.registerWorkflowImplementationTypes(wio, PipelineWorkflowImpl.class);

$docker run --network=host --rm ubercadence/cli:master --do PIPE workflow start --tasklist Pipeline --workflow_type PipelineWorkflow::runPipelineZZZ --execution_timeout 3600 --input \"ConfigABC\"

2020-01-10 10:03:42 ERROR PollerOptions:120 - uncaught exception
java.lang.RuntimeException: Failure processing decision task. WorkflowID=3586aae7-faa8-484a-8e14-bba7a5eb6735, RunID=d29985b2-d113-4508-b120-f63a8d92045c
    at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.wrapFailure(WorkflowWorker.java:283)
    at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.wrapFailure(WorkflowWorker.java:229)
    at com.uber.cadence.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:76)
    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)
Caused by: java.lang.Error: Unknown workflow type "PipelineWorkflow::runPipelineZZZ". Known types are [PipelineWorkflow::runPipeline]
    at com.uber.cadence.internal.sync.POJOWorkflowImplementationFactory.getWorkflowDefinition(POJOWorkflowImplementationFactory.java:188)
    at com.uber.cadence.internal.sync.POJOWorkflowImplementationFactory.getWorkflow(POJOWorkflowImplementationFactory.java:203)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.createDecider(ReplayDecisionTaskHandler.java:280)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.lambda$processDecision$0(ReplayDecisionTaskHandler.java:141)
    at com.uber.cadence.internal.replay.DeciderCache.getOrCreate(DeciderCache.java:65)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.processDecision(ReplayDecisionTaskHandler.java:137)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.handleDecisionTaskImpl(ReplayDecisionTaskHandler.java:125)
    at com.uber.cadence.internal.replay.ReplayDecisionTaskHandler.handleDecisionTask(ReplayDecisionTaskHandler.java:86)
    at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:257)
    at com.uber.cadence.internal.worker.WorkflowWorker$TaskHandlerImpl.handle(WorkflowWorker.java:229)
    at com.uber.cadence.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:71)
    ... 3 more
mfateev commented 4 years ago

This works as designed. The NonDeterministicWorkflowPolicy is associated to a specific workflow type. As you are starting workflow with a different type the worker rejects the workflow it doesn't support. As it is usually an intermittent problem in production (for example during rolling deployment of the new workflow code) the workflow is not terminated, but is blocked.