Skip to content
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

[BUG] Fail to resume activity when there have Int32 variable #6235

Open
TimNguyenVN opened this issue Dec 24, 2024 · 0 comments
Open

[BUG] Fail to resume activity when there have Int32 variable #6235

TimNguyenVN opened this issue Dec 24, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@TimNguyenVN
Copy link

TimNguyenVN commented Dec 24, 2024

Hi @sfmskywalker, I am encountering an issue with workflows when using int variables stored in the workflow instance. Can you take a look at here? Thank you so much!

Steps to Reproduce

  • Add a variable type Int32 with Storage Workflow Instance
  • Add activity Set Variable to set it to 0, 1, 2… with default input type (not C# or JavaScript)
  • Add Delay activity and set delay time to 10s
  • Execute Workflow

Result

Workflow stuck at Suspend state and the Delay activity also got stuck but did not throw any exception

Expect behavior

Workflow resume and continue

Exception:

System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $ | LineNumber: 0 | BytePositionInLine: 5.
       ---> System.InvalidOperationException: Cannot get the value of a token type 'String' as a number.
         at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
         at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)
         at System.Text.Json.Utf8JsonReader.GetInt32()
         at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
         at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
         at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
         --- End of inner exception stack trace ---
         at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
         at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
         at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
         at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state)
         at System.Text.Json.JsonSerializer.ReadFromSpanAsObject(ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
         at System.Text.Json.JsonSerializer.ReadFromNodeAsObject(JsonNode node, JsonTypeInfo jsonTypeInfo)
         at System.Text.Json.JsonSerializer.Deserialize(JsonNode node, Type returnType, JsonSerializerOptions options)
         at Elsa.Expressions.Helpers.ObjectConverter.ConvertTo(Object value, Type targetType, ObjectConverterOptions converterOptions)
         at Elsa.Extensions.VariableExtensions.ParseValue(Variable variable, Object value)
         at Elsa.Workflows.Services.VariablePersistenceManager.LoadVariablesAsync(WorkflowExecutionContext workflowExecutionContext)
         at Elsa.Workflows.Runtime.Middleware.Workflows.PersistentVariablesMiddleware.InvokeAsync(WorkflowExecutionContext context)
         at Elsa.Workflows.Runtime.Middleware.Workflows.PersistWorkflowExecutionLogMiddleware.InvokeAsync(WorkflowExecutionContext context)
         at Elsa.Workflows.Runtime.Middleware.Workflows.PersistActivityExecutionLogMiddleware.InvokeAsync(WorkflowExecutionContext context)
         at Elsa.Workflows.Runtime.Middleware.Workflows.PersistBookmarkMiddleware.InvokeAsync(WorkflowExecutionContext context)
         at Elsa.Workflows.Runtime.Middleware.Workflows.ScheduleBackgroundActivitiesMiddleware.InvokeAsync(WorkflowExecutionContext context)
         at Elsa.Workflows.Middleware.Workflows.EngineExceptionHandlingMiddleware.InvokeAsync(WorkflowExecutionContext context)

Note:

This issue does not happen with storage Workflow or memory and C#, JavaScript also return int. So there maybe a problem in the process deserialize data in workflow instance
Need to explore more case with set variable because it do not throw exception at the set step.

Environment

  • Elsa Package Version: 3.2.1
  • Operating System: Windows 10

Export json

workflow-1.json

@TimNguyenVN TimNguyenVN added the bug Something isn't working label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant