elsa-workflows / elsa-workflows/elsa-core

[BUG] Problem with WriteHttpResponse Activity on External Workflow Start

Open
#5,270 3 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
In my scenario, there are two workflows, A and B. A has a cron job that starts B every x minutes. B has no interruptions and is supposed to run continuously every x minutes. Now, my problem is that when the workflow is triggered by A, the WriteHttpResponse activity does not terminate but goes into a suspended state. If I manually start B, this problem does not occur, so I suspect an issue in the interaction between the cron job and the WriteHttpResponse activity.

## Steps to Reproduce
The problem can be simplified from two workflows to one. If we create a workflow C that is supposed to be started by a cron job every x minutes and it contains a WriteHttpResponse somewhere, it gets stuck at the WriteHttpResponse, and the workflow remains in a suspended state without progressing. Also, it's worth mentioning that if we don't use a cron activity to start the workflow, i.e., if we execute it manually, the problem does not occur.

What I have tested so far:

Manually starting the workflow: works
Starting the workflow via cron: suspended
Starting the workflow via event: suspended

### Attachments

Workflow without cron/ event:
![Screenshot 2024-04-24 072339](https://github.com/elsa-workflows/elsa-core/assets/159249295/f45308d4-eda8-4895-88aa-90a7c96cccfe)

Execution:
![Screenshot 2024-04-24 072358](https://github.com/elsa-workflows/elsa-core/assets/159249295/94a9410b-64f2-4706-ba27-e86f80e41bc7)

Workflow with cron:
![Screenshot 2024-04-24 072316](https://github.com/elsa-workflows/elsa-core/assets/159249295/57397bbe-4fb2-4ab5-9d7f-a6e45695b160)

Execution:
![Screenshot 2024-04-24 072417](https://github.com/elsa-workflows/elsa-core/assets/159249295/0a51ec8d-b951-48d7-bd11-3eb419ac07d5)

Workflow with event:
![Screenshot 2024-04-24 072455](https://github.com/elsa-workflows/elsa-core/assets/159249295/4b1bd68e-45cd-41e6-8ad0-0693eb21485c)

Execution:
![Screenshot 2024-04-24 072530](https://github.com/elsa-workflows/elsa-core/assets/159249295/0f33f5f1-bc62-4e63-9bcc-f97773fc0e23)

## Expected Behavior

I expect the workflow to finish, just as it does without the cron/event.

## Actual Behavior
The workflow gets into a suspended state and does not continue.

## Related Issues
Issues that I found also have a problem with the WriteHttpResponse:

- https://github.com/elsa-workflows/elsa-core/issues/5267

The issue I mentioned earlier:

- https://github.com/elsa-workflows/elsa-core/issues/4895

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.