-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
System.InvalidOperationException: Workflow graph with handle DefinitionVersionId: not found. #6362
Comments
Fixed via da6eda2 |
Tried
|
Is that a new job execution, or is it trying to run already scheduled jobs? |
I updated your sample project to the 3.3.2-rc2 packages, and the error has disappeared (after making sure there were no existing jobs scheduled). |
Perhaps try the same zip file you shared with me, upgrade it to 3.3.2 (just released), and make sure to clear the Hangfire tables (or configure Hangfire to connect to a different database like you attempted). For me, your zip file works flawlessly. I was able to reproduce the symptom that you described, and they were gone after updating to 3.3.2-rc2 (after cleaning Hangfire tables). |
Upgraded to 3.3.2. Even with Hangfire dependencies removed and Hangfire not used at all in the process, I still get the error:
I have attached the Hangfire free project and output log. |
Ah, I see. This is not related to Hangfire then. Thank you for the reproduction, I will look into it. |
I see what the issue is. There's a small design flaw with the way programmatic workflows are used with the WorkflowRunner in combination with long-running workflows. In order for a long-running workflow to be resumed (e.g. when using the Delay activity), the workflow definition must exist in the store. This is the case, because you register the workflow with the system. When the workflow gets added to the store, the CLR workflow provider generates a different version ID for the workflow definition. Also, when using a custom identifier such as "X", that value is associated with the workflow definition. So far, so good. Here is where things don't line up: When calling To work around this issue, you can update your code like this: var workflowDefinitionService = serviceProvider.GetRequiredService<IWorkflowDefinitionService>();
var workflowGraph = await workflowDefinitionService.FindWorkflowGraphAsync("X", VersionOptions.Published);
await workflowRunner.RunAsync(workflowGraph, new RunWorkflowOptions { Input = input }); Basically what we are doing is taking care of selecting the workflow definition to execute ourselves, which we then pass into the workflow runner, instead of passing only the workflow type, which doesn't provide enough information to the runner because it doesn't go through the workflow provider API. I'll keep this issue open to fix that for 3.4. |
@sfmskywalker it works now! Thanks for the workaround. FYI, when starting with clean database this
results in an error
but
will create migrate the schema and create the tables. |
Also when you change the version of the workflow to 2, you get an incident, status is
|
Description
Workflow with delay does not finish because of the error. The project is using Hangfire for scheduling and sqlite database for persistence. In the database the value of DefinitionVersionId in the corresponding row of WorkflowInstance table is empty string.
Steps to Reproduce
To help us identify the issue more quickly, please follow these guidelines:
Attachments: The minimal project is attached - workflows.zip.
Reproduction Rate: every time.
Additional Configuration: no additional configuration
Expected Behavior
I expect the workflow to finish without any issues.
Actual Behavior
The workflow does not continue when resumed after delay.
Environment
Log Output
The text was updated successfully, but these errors were encountered: