sdk-java icon indicating copy to clipboard operation
sdk-java copied to clipboard

WorkflowReplayer throws unclear exception when LocalActivityOptions are misconfigured

Open tylercunnion opened this issue 3 years ago • 0 comments

Expected Behavior

When using WorkflowReplayer with the TestWorkflowEnvironment, I expect missing/misconfigured LocalActivityOptions to throw a useful error, similar to the one presented when missing regular ActivityOptions:

Caused by: java.lang.IllegalArgumentException: Both StartToCloseTimeout and ScheduleToCloseTimeout aren't specified for ImportInitialization activity. Please set at least one of the above through the ActivityStub or WorkflowImplementationOptions.

Actual Behavior

The exception presented is fairly cryptic:

java.lang.RuntimeException: query failure for workflow_id: "workflow_id_in_replay"
run_id: "run_id_in_replay", queryType=__replay_only, args=Optional.empty, error=java.lang.Error: closed

Stepping through shows that the cause is in the validateAndBuildWithDefaults method - but this IllegalArgumentException is somehow swallowed (the next step jumps to this finally block in CancellationScopeImpl ). If this exception ended up being displayed the problem would have been pretty obvious and quick to solve.

Steps to Reproduce the Problem

  1. Write and run a workflow that uses a Local Activity. (It MAY be necessary to run inside a CancellationScope, haven't tested extensively)
  2. Create a TestWorkflowEnvironment that does not have default LocalActivityOptions configured, and use it with WorkflowReplayer to replay the workflow history.

Specifications

  • Version: observed in SDK v1.18.2 and 1.20.1
  • Platform: Mac

tylercunnion avatar Jul 31 '23 22:07 tylercunnion