temporalio / temporalio/sdk-java

WorkflowReplayer throws unclear exception when LocalActivityOptions are misconfigured

Open
#1,830 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

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

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 LocalActivityOptions.validateAndBuildWithDefaults and follow exception handling through CancellationScopeImpl's finally block. Reproduce the issue with WorkflowReplayer and TestWorkflowEnvironment using a workflow with a Local Activity and no default LocalActivityOptions. Done means the misconfiguration produces a useful ActivityOptions-style error instead of the cryptic query failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.