Closed xrenaissance closed 2 weeks ago
Please provide a minimal DSL that can reproduce this problem as well.
Hello, @xrenaissance! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm a bot designed to assist you while you wait for a human maintainer.
There are a few similar issues and discussions related to parallel node execution in Dify:
The failure in parallel node execution in version 0.8.1 is likely due to changes in the event handling mechanism and the introduction of new constraints in the thread pool management. Specifically, the _handle_event
method in api/core/app/apps/workflow_app_runner.py
now includes additional event types and handling logic that might be causing the failure. Additionally, the GraphEngineThreadPool
class in api/core/workflow/graph_engine/graph_engine.py
now includes a max_submit_count
parameter, which limits the number of tasks that can be submitted to the thread pool. If the number of submitted tasks exceeds this limit, a ValueError
is raised [4][5].
These changes could be the reason why parallel node execution fails in version 0.8.1.
To continue talking to Dosu, mention @dosu.
This bug is quite weird: if I extract minimum dsl, like this. it works perfectly:
but, once I integrate sub-dsl into a long workflow, it just showed failed bug:
I'm having the same problem. @crazywoola
Here is my DSL:
app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
name: testDSL
use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
opening_statement: ''
retriever_resource:
enabled: false
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
sourceType: llm
targetType: llm
id: 1711067429397-1711067578643
selected: false
source: '1711067429397'
sourceHandle: source
target: '1711067578643'
targetHandle: target
type: custom
- data:
isInIteration: false
sourceType: if-else
targetType: llm
id: 1724911834337-true-1711067429397-target
selected: false
source: '1724911834337'
sourceHandle: 'true'
target: '1711067429397'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: if-else
targetType: llm
id: 1724911834337-false-1724911885495-target
selected: false
source: '1724911834337'
sourceHandle: 'false'
target: '1724911885495'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: llm
id: 1711067429397-source-1726205039720-target
selected: false
source: '1711067429397'
sourceHandle: source
target: '1726205039720'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: llm
id: 1711067429397-source-1726205041905-target
selected: false
source: '1711067429397'
sourceHandle: source
target: '1726205041905'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: if-else
targetType: llm
id: 1724911834337-false-1726208766514-target
selected: false
source: '1724911834337'
sourceHandle: 'false'
target: '1726208766514'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: if-else
targetType: llm
id: 1724911834337-false-1726208769053-target
selected: false
source: '1724911834337'
sourceHandle: 'false'
target: '1726208769053'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: template-transform
id: 1724911885495-source-1726209725220-target
selected: false
source: '1724911885495'
sourceHandle: source
target: '1726209725220'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: template-transform
id: 1726208766514-source-1726209725220-target
selected: false
source: '1726208766514'
sourceHandle: source
target: '1726209725220'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: template-transform
id: 1726208769053-source-1726209725220-target
selected: false
source: '1726208769053'
sourceHandle: source
target: '1726209725220'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: template-transform
targetType: end
id: 1726209725220-source-1726209763446-target
selected: false
source: '1726209725220'
sourceHandle: source
target: '1726209763446'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: end
id: 1711067578643-source-1726205196743-target
source: '1711067578643'
sourceHandle: source
target: '1726205196743'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: end
id: 1726205039720-source-1726205196743-target
source: '1726205039720'
sourceHandle: source
target: '1726205196743'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: end
id: 1726205041905-source-1726205196743-target
source: '1726205041905'
sourceHandle: source
target: '1726205196743'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: start
targetType: if-else
id: 1711067409646-source-1724911834337-target
source: '1711067409646'
sourceHandle: source
target: '1724911834337'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: Start
type: start
variables:
- label: title
max_length: null
options: []
required: true
type: text-input
variable: title
- label: content
max_length: 3000
options: []
required: true
type: paragraph
variable: content
dragging: false
height: 116
id: '1711067409646'
position:
x: 416.4607464639603
y: 2780.428809012738
positionAbsolute:
x: 416.4607464639603
y: 2780.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: true
variable_selector:
- '1711067409646'
- content
desc: ''
model:
completion_params: {}
mode: chat
name: gpt-4o-mini
provider: openai
prompt_template:
- id: 4c08e889-b9cb-49a1-b941-bd156f4b2329
role: system
text: 复述{{#1711067409646.title#}}
selected: false
title: '1'
type: llm
variables:
- value_selector:
- '1711067409646'
- input_text
variable: input_text
vision:
configs:
detail: high
enabled: true
dragging: false
height: 98
id: '1711067429397'
position:
x: 1339.8210389616602
y: 2780.428809012738
positionAbsolute:
x: 1339.8210389616602
y: 2780.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: true
variable_selector:
- '1711067429397'
- text
desc: ''
model:
completion_params:
frequency_penalty: 0.3
max_tokens: 2101
presence_penalty: 0.2
temperature: 0.5
top_p: 0.85
mode: chat
name: gpt-4o-mini
provider: openai
prompt_template:
- id: 3a80e17e-9b2e-426e-986d-94e3ec2d80f3
role: system
text: 复述{{#1711067409646.title#}}
selected: false
title: '2'
type: llm
variables:
- value_selector:
- '1711067409646'
- input_text
variable: input_text
vision:
configs:
detail: high
enabled: true
dragging: false
height: 98
id: '1711067578643'
position:
x: 1641.7248482528303
y: 2780.428809012738
positionAbsolute:
x: 1641.7248482528303
y: 2780.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
cases:
- case_id: 'true'
conditions:
- comparison_operator: not empty
id: b4769518-6816-45fc-91c4-dabcd60d4888
value: ''
varType: string
variable_selector:
- '1711067409646'
- title
id: 'true'
logical_operator: and
desc: ''
selected: false
title: 条件分支
type: if-else
height: 126
id: '1724911834337'
position:
x: 794.7030764731828
y: 2780.428809012738
positionAbsolute:
x: 794.7030764731828
y: 2780.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: gpt-4o-mini
provider: openai
prompt_template:
- id: 5e677f8b-1b4e-41db-91d3-c94641f69dcb
role: system
text: 复述{{#1711067409646.title#}}
selected: false
title: '5'
type: llm
variables: []
vision:
configs:
detail: high
enabled: true
height: 98
id: '1724911885495'
position:
x: 1339.8210389616602
y: 3331.1427492602425
positionAbsolute:
x: 1339.8210389616602
y: 3331.1427492602425
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: qwen-max
provider: tongyi
prompt_template:
- id: e57dd54e-5058-40b1-81b3-94440383ea97
role: system
text: ''
- id: 92a6a702-7dde-4898-85ab-d28436abfa4b
role: user
text: 复述{{#1711067409646.title#}}
selected: false
title: '3'
type: llm
variables: []
vision:
enabled: false
height: 98
id: '1726205039720'
position:
x: 1641.7248482528303
y: 2945.428809012738
positionAbsolute:
x: 1641.7248482528303
y: 2945.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: ernie-4.0-turbo-8k
provider: wenxin
prompt_template:
- id: 51ff0e16-6559-44be-9ae9-0c6dd7bd2bc1
role: system
text: ''
- id: ef4f1576-e5a6-4894-a1e0-5714a12b6c93
role: user
text: 复述{{#1711067409646.title#}}
selected: false
title: '4'
type: llm
variables: []
vision:
enabled: false
height: 98
id: '1726205041905'
position:
x: 1641.7248482528303
y: 3082.428809012738
positionAbsolute:
x: 1641.7248482528303
y: 3082.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
outputs:
- value_selector:
- '1711067578643'
- text
variable: text
- value_selector:
- '1726205041905'
- text
variable: text
- value_selector:
- '1726205039720'
- text
variable: text
selected: false
title: 结束 2
type: end
height: 142
id: '1726205196743'
position:
x: 2249.7248482528303
y: 2780.428809012738
positionAbsolute:
x: 2249.7248482528303
y: 2780.428809012738
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: qwen-max
provider: tongyi
prompt_template:
- id: b22353b2-39dd-497c-b8aa-6bad4fde8ef8
role: system
text: ''
- id: 8a746ea6-6a75-45f5-a65a-2ba7273093ee
role: user
text: 复述{{#1711067409646.title#}}
selected: false
title: '6'
type: llm
variables: []
vision:
enabled: false
height: 98
id: '1726208766514'
position:
x: 1339.8210389616602
y: 3468.1427492602425
positionAbsolute:
x: 1339.8210389616602
y: 3468.1427492602425
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: ernie-4.0-turbo-8k
provider: wenxin
prompt_template:
- id: 8d1bd772-410b-4a39-9006-55f4e5c8d9b0
role: system
text: ''
- id: 12f91d91-6040-4890-9d9d-81debcf6f89a
role: user
text: 复述{{#1711067409646.title#}}
selected: false
title: '7'
type: llm
variables: []
vision:
enabled: false
height: 98
id: '1726208769053'
position:
x: 1339.8210389616602
y: 3605.1427492602425
positionAbsolute:
x: 1339.8210389616602
y: 3605.1427492602425
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
selected: false
template: '# gpt-4o 输出
{{ gpt4o }}
# 通义千问 输出
{{ qianwen }}
# 文心一言 输出
{{ wenxinyiyan }}'
title: 模板转换 2
type: template-transform
variables:
- value_selector:
- '1724911885495'
- text
variable: gpt4o
- value_selector:
- '1726208766514'
- text
variable: qianwen
- value_selector:
- '1726208769053'
- text
variable: wenxinyiyan
height: 54
id: '1726209725220'
position:
x: 1643.8210389616602
y: 3331.1427492602425
positionAbsolute:
x: 1643.8210389616602
y: 3331.1427492602425
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
outputs:
- value_selector:
- '1726209725220'
- output
variable: text
selected: false
title: 结束 2
type: end
height: 90
id: '1726209763446'
position:
x: 1947.8210389616602
y: 3331.1427492602425
positionAbsolute:
x: 1947.8210389616602
y: 3331.1427492602425
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
viewport:
x: -301.8133370454726
y: -1032.6094561132456
zoom: 0.5255864545438544
I upgraded to the latest version 0.8.2, the same bug still exists.
Self Checks
Dify version
0.8.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
0.8 works perfectly for parallel node execution, but while upgraded to 0.8.1, it does not work, and I did not get why?
✔️ Expected Behavior
parallel execute without bug
❌ Actual Behavior
Run Faild