elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
6.3k stars 1.16k forks source link

504 Timeout error on workflow-instance #4437

Open poweriton opened 1 year ago

poweriton commented 1 year ago

Problem

Im experiencing an issue whereby the workflow instance page fails to load due to a 504 timeout error. This becomes apparent after a number of workflows have been run. New workflow instances appear to continue to function, however i am unable to verify/debug issues due to the lack of visibility on the date inside a workflow

Work Around

As a temporary solution clearing down the workflow instance table in the database allows access to the page. However we have a number of long running workflows and clearing down the table is not really a viable solution in our live environment.

image

sfmskywalker commented 1 year ago

Hi @poweriton

I suspect that the size of the Data field of a given workflow instance record is relatively large. When listing workflow instances with very large Data fields, it will take time for the server to not only load, but also deserialize the Data contents. The more workflow instances are being loaded, the more time it takes, leading to server time outs.

The real problem here is that the workflow instance EF core store is trying to load the Data column, which shouldn't happen because it's not necessary.

This has been fixed for Elsa 3, but not for Elsa 2.

poweriton commented 1 year ago

Thanks @sfmskywalker

Given the breaking changes in v3 im hesitant to do the upgrade until your a bit further down the roadmap. Would the interim solution be to create an index view and call the database directly, excluding the data field? Can you see any issues with this method?

sfmskywalker commented 1 year ago

I completely understand the hesitancy. With regards to the interim solution you're suggesting, are you asking about implementing your own index view in your own application, or whether it's be a viable option to include in the Elsa repo?