How to stop non-deterministic error retry forever?

Hey,

I am testing with golang-sdk and java-sdk. I try to catch all throwable from our definition. But I still find non-deterministic error makes the workflow task retry forever. Could we have a way to make it stop or block for a while?

1 Like

Hi @maki_XIE

NonDeterministicException is not propagated to workflow code, as you have mentioned you can not catch it.

To stop your workflow from retrying the workflow task when facing a non-deterministic code, you can use setFailWorkflowExceptionTypes in WorkflowImplementationOptions

WorkflowImplementationOptions.newBuilder()
   .setFailWorkflowExceptionTypes(NonDeterministicException.class)
   .build(),

Another way is to set WorkflowRunTimeout in your WorkflowOptions to limit the duration of your workflow run, so after some time including workflow task retries, the workflow will fail.

Both options will fail your Workflow Execution.

1 Like

@antonio.perez would you mind sharing a golang code snippet to accomplish the same “fail on non-deterministic error” behavior? I assume I need to set something in RetryOptions.NonRetryableErrorTypes, but I’m not sure what the proper string to feed in there would be

For Go you would tell worker to fail on panic:

w := worker.New(c, "tqname", worker.Options{
  // ...
  WorkflowPanicPolicy: worker.FailWorkflow,
})

Awesome, thanks for that!

Sorry to revive such an old thread; I’m looking for a similar option to set for the typescript sdk, but can’t seem to find one in worker-options.ts. Does one exist?