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

DurableTasks: Warning when workflow started outside of the SDK context

Open salaboy opened this issue 7 months ago • 5 comments

Expected Behavior

Not sure, but at least the warning should be more clear about why it is failing on the durable task side.

Actual Behavior

You start a Java application with some workflows registered, but instead of using the application to create a new instance, you send a curl request to the Dapr API to start a new workflow instance.

In that situation, because the App doesn't have started the workflow and probably don't have the context, durable task framework prints this warning:

2025-05-16T15:28:17.408+01:00  WARN 20378 --- [pool-3-thread-1] io.dapr.durabletask                      : The orchestrator failed with an unhandled exception: java.lang.NullPointerException: Cannot invoke "io.dapr.durabletask.TaskOrchestrationFactory.create()" because "factory" is null

Release Note

RELEASE NOTE:

salaboy avatar May 16 '25 14:05 salaboy

Related to: https://github.com/dapr/java-sdk/issues/1357

salaboy avatar May 16 '25 14:05 salaboy

After further inspection, the Warning only appears if you call a Workflow that is not registered or use the wrong name of the workflow. I think the only action item here is to refine the Warning message on the durable-task.

salaboy avatar May 16 '25 15:05 salaboy

One thing to try here is to add a log line here: https://github.com/dapr/durabletask-java/blob/main/client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java#L62 to evaluate if the context is null and mention that there is no context associated with the workflow that you are trying to execute, because it doesn't exist. But this is all handled in the SDK code.

As mentioned before, this will not happen if all the requests come from an application that is using the SDK

salaboy avatar May 17 '25 10:05 salaboy

@salaboy I can look at this.

siri-varma avatar May 19 '25 17:05 siri-varma

/assign

siri-varma avatar May 19 '25 17:05 siri-varma