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

Flowchart with FlowJoin unexpected behaviour #6448

Open
Nordran opened this issue Feb 25, 2025 · 2 comments
Open

Flowchart with FlowJoin unexpected behaviour #6448

Nordran opened this issue Feb 25, 2025 · 2 comments

Comments

@Nordran
Copy link

Nordran commented Feb 25, 2025

There is probably wrong behaviour when Elsa reach FlowJoin with WaitAny mode and cancel one of previous activities. If there is no other running activities at this moment Flowchart will be completed even if there is some activiy after FlowJoin.

It looks like
FlowJoin cancels activity -> Activity canceled event called -> Flowchart processes it with OnActivityCanceledAsync -> CompleteIfNoPendingWorkAsync -> HasPendingWork doesn't see FlowJoin as its children -> CompleteIfNoPendingWorkAsync completes Flowchart.

Some simple workflow to reproduce:

{
	"$schema": "https://elsaworkflows.io/schemas/workflow-definition/v3.0.0/schema.json",
	"id": "d5dcc4c36e2dd342",
	"definitionId": "ff9b2d329e049f58",
	"name": "JoinError",
	"createdAt": "2025-02-25T11:38:24.419311+00:00",
	"version": 2,
	"toolVersion": "3.3.0.0",
	"variables": [],
	"inputs": [],
	"outputs": [],
	"outcomes": [],
	"customProperties": {},
	"isReadonly": false,
	"isSystem": false,
	"isLatest": true,
	"isPublished": true,
	"options": {
		"autoUpdateConsumingWorkflows": false
	},
	"root": {
		"id": "642a65d729a4f452",
		"nodeId": "Workflow1:642a65d729a4f452",
		"name": "Flowchart1",
		"type": "Elsa.Flowchart",
		"version": 1,
		"customProperties": {
			"notFoundConnections": [],
			"canStartWorkflow": false,
			"runAsynchronously": false
		},
		"metadata": {},
		"activities": [
			{
				"path": {
					"typeName": "String",
					"expression": {
						"type": "Literal",
						"value": "join/error"
					}
				},
				"supportedMethods": {
					"typeName": "List<String>",
					"expression": {
						"type": "Literal",
						"value": "[\"GET\"]"
					}
				},
				"authorize": {
					"typeName": "Boolean",
					"expression": {
						"type": "Literal",
						"value": false
					}
				},
				"policy": {
					"typeName": "String",
					"expression": {
						"type": "Literal"
					}
				},
				"requestTimeout": null,
				"requestSizeLimit": null,
				"fileSizeLimit": null,
				"allowedFileExtensions": null,
				"blockedFileExtensions": null,
				"allowedMimeTypes": null,
				"exposeRequestTooLargeOutcome": false,
				"exposeFileTooLargeOutcome": false,
				"exposeInvalidFileExtensionOutcome": false,
				"exposeInvalidFileMimeTypeOutcome": false,
				"parsedContent": null,
				"files": null,
				"routeData": null,
				"queryStringData": null,
				"headers": null,
				"result": null,
				"id": "b07b220561e7df0b",
				"nodeId": "Workflow1:642a65d729a4f452:b07b220561e7df0b",
				"name": "",
				"type": "Elsa.HttpEndpoint",
				"version": 1,
				"customProperties": {
					"canStartWorkflow": true,
					"runAsynchronously": false
				},
				"metadata": {
					"designer": {
						"position": {
							"x": -400,
							"y": -200
						},
						"size": {
							"width": 174.15625,
							"height": 50
						}
					}
				}
			},
			{
				"mode": {
					"typeName": "Elsa.Workflows.Activities.Flowchart.Models.FlowJoinMode, Elsa.Workflows.Core",
					"expression": {
						"type": "Literal",
						"value": "WaitAny"
					}
				},
				"id": "7aaa8557aeb3305d",
				"nodeId": "Workflow1:642a65d729a4f452:7aaa8557aeb3305d",
				"name": "",
				"type": "Elsa.FlowJoin",
				"version": 1,
				"customProperties": {
					"canStartWorkflow": false,
					"runAsynchronously": false
				},
				"metadata": {
					"designer": {
						"position": {
							"x": 84.5,
							"y": -230
						},
						"size": {
							"width": 97.78125,
							"height": 50
						}
					}
				}
			},
			{
				"text": {
					"typeName": "String",
					"expression": {
						"type": "Literal",
						"value": "Node11"
					}
				},
				"id": "eee91c05db2f48c9",
				"nodeId": "Workflow1:642a65d729a4f452:eee91c05db2f48c9",
				"name": "Node11",
				"type": "Elsa.WriteLine",
				"version": 1,
				"customProperties": {
					"canStartWorkflow": false,
					"runAsynchronously": false
				},
				"metadata": {
					"designer": {
						"position": {
							"x": -140,
							"y": -280
						},
						"size": {
							"width": 123.578125,
							"height": 50
						}
					},
					"displayText": "Node11"
				}
			},
			{
				"text": {
					"typeName": "String",
					"expression": {
						"type": "Literal",
						"value": "Node2"
					}
				},
				"id": "35139d16b56345e6",
				"nodeId": "Workflow1:642a65d729a4f452:35139d16b56345e6",
				"name": "Node2",
				"type": "Elsa.WriteLine",
				"version": 1,
				"customProperties": {
					"canStartWorkflow": false,
					"runAsynchronously": false
				},
				"metadata": {
					"designer": {
						"position": {
							"x": 244.5,
							"y": -230
						},
						"size": {
							"width": 114.484375,
							"height": 50
						}
					},
					"displayText": "Node2"
				}
			},
			{
				"path": {
					"typeName": "String",
					"expression": {
						"type": "Literal",
						"value": "join/cont"
					}
				},
				"supportedMethods": {
					"typeName": "List<String>",
					"expression": {
						"type": "Literal",
						"value": "[\"GET\"]"
					}
				},
				"authorize": {
					"typeName": "Boolean",
					"expression": {
						"type": "Literal",
						"value": false
					}
				},
				"policy": {
					"typeName": "String",
					"expression": {
						"type": "Literal"
					}
				},
				"requestTimeout": null,
				"requestSizeLimit": null,
				"fileSizeLimit": null,
				"allowedFileExtensions": null,
				"blockedFileExtensions": null,
				"allowedMimeTypes": null,
				"exposeRequestTooLargeOutcome": false,
				"exposeFileTooLargeOutcome": false,
				"exposeInvalidFileExtensionOutcome": false,
				"exposeInvalidFileMimeTypeOutcome": false,
				"parsedContent": null,
				"files": null,
				"routeData": null,
				"queryStringData": null,
				"headers": null,
				"result": null,
				"id": "792a7225dc5e46e5",
				"nodeId": "Workflow1:642a65d729a4f452:792a7225dc5e46e5",
				"name": "",
				"type": "Elsa.HttpEndpoint",
				"version": 1,
				"customProperties": {
					"canStartWorkflow": false,
					"runAsynchronously": false
				},
				"metadata": {
					"designer": {
						"position": {
							"x": -120,
							"y": -100
						},
						"size": {
							"width": 174.15625,
							"height": 50
						}
					}
				}
			}
		],
		"variables": [],
		"connections": [
			{
				"source": {
					"activity": "b07b220561e7df0b",
					"port": "Done"
				},
				"target": {
					"activity": "eee91c05db2f48c9",
					"port": "In"
				}
			},
			{
				"source": {
					"activity": "eee91c05db2f48c9",
					"port": "Done"
				},
				"target": {
					"activity": "7aaa8557aeb3305d",
					"port": "In"
				}
			},
			{
				"source": {
					"activity": "7aaa8557aeb3305d",
					"port": "Done"
				},
				"target": {
					"activity": "35139d16b56345e6",
					"port": "In"
				}
			},
			{
				"source": {
					"activity": "b07b220561e7df0b",
					"port": "Done"
				},
				"target": {
					"activity": "792a7225dc5e46e5",
					"port": "In"
				}
			},
			{
				"source": {
					"activity": "792a7225dc5e46e5",
					"port": "Done"
				},
				"target": {
					"activity": "7aaa8557aeb3305d",
					"port": "In"
				}
			}
		]
	}
}

Expected Behavior

Node2 is executed

Actual Behavior

Flowcahrt is completed after FlowJoin

Environment

Elsa 3.3

@Nordran
Copy link
Author

Nordran commented Feb 26, 2025

It seems to be fixed with #6423

@Nordran Nordran closed this as completed Feb 26, 2025
@Nordran
Copy link
Author

Nordran commented Feb 26, 2025

Is there a chance that this fix will be included in next minor version?

@Nordran Nordran reopened this Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant