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

Http Request run Asynchronously but the workflow got suspended and never return the result #4763

Closed
jordanpedro opened this issue Jan 7, 2024 · 2 comments
Assignees
Labels
bug Something isn't working elsa 3 This issue is specific to Elsa 3
Milestone

Comments

@jordanpedro
Copy link

jordanpedro commented Jan 7, 2024

Hi,regarding the issue #4737
i believe The Problem now is that the next activity after the multiple Async http calls never gets executed
http-async-calls (2).json

image

and also the activity Http Request (Flow) still has the suspendend problem that i mentioned in the title of the issue.

http-flow-async-calls.json

image
so , the fix via 7c632a5 didnt solve the whole issue

@jordanpedro jordanpedro changed the title Http Request run Asynchronously but the workflow got suspended and never return the result #4737 Http Request run Asynchronously but the workflow got suspended and never return the result Jan 7, 2024
@sfmskywalker sfmskywalker self-assigned this Jan 7, 2024
@sfmskywalker
Copy link
Member

I can confirm the issue - thanks for the great repro steps @jordanpedro ! I am woking on the fix.

@sfmskywalker sfmskywalker added bug Something isn't working elsa 3 This issue is specific to Elsa 3 labels Jan 7, 2024
@sfmskywalker sfmskywalker added this to the Elsa 3.1 milestone Jan 7, 2024
sfmskywalker added a commit that referenced this issue Jan 7, 2024
The code was adjusted to correctly handle cases when the method `GetBackgroundOutcomes` returns null. This would cause the activity to complete prematurely.

Fixes #4763
@sfmskywalker
Copy link
Member

sfmskywalker commented Jan 7, 2024

The first issue is resolved via c2ec2bd, very nice catch.
The second issue is a different one and has to do with the fact that as soon as the engine schedules activities for execution in the background, it will create bookmarks and suspend the workflow. Once both background jobs have finished, the workflow instance is resumed from the background, at which point there is no HTTP context to write a response to, which is why the HTTP Response activity remains in the Suspended state (it's waiting for the workflow to be resumed from an HTTP context, but this never happens).

If you were to replace the HTTP Response activity with a WriteLine activity for example, then you will see that the workflow completes.

If we want to support scenarios where we execute certain activities from the background, without suspending the workflow instance, we need a different implementation where activities are executed concurrently in memory.

I think it's possible, but out of scope for this issue. Please feel free to open a separate issue requesting the parallel execution of activities while keeping the workflow instance in tact (i.e. without suspending the workflow instance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working elsa 3 This issue is specific to Elsa 3
Projects
Status: Done
Development

No branches or pull requests

2 participants