Running 2 iteration nodes in parallel causes iteration restart #8121

Closed
opened 2026-02-21 18:24:03 -05:00 by yindo · 8 comments
Owner

Originally created by @DavideDelbianco on GitHub (Feb 10, 2025).

Originally assigned to: @laipz8200 on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Create a workflow with 2 iteration nodes that run in parallel mode and merge in the same node
video: https://drive.google.com/file/d/1XT93SqL-TsoknINr0X4Qya1QyHxU2ljT/view?usp=sharing

✔️ Expected Behavior

When the first iteration node is complete, it should wait for the second iteration node, without restarting it

Actual Behavior

The iterations count restarts in the parallel iteration that was still running when the first one completed

Originally created by @DavideDelbianco on GitHub (Feb 10, 2025). Originally assigned to: @laipz8200 on GitHub. ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Create a workflow with 2 iteration nodes that run in parallel mode and merge in the same node video: https://drive.google.com/file/d/1XT93SqL-TsoknINr0X4Qya1QyHxU2ljT/view?usp=sharing ### ✔️ Expected Behavior When the first iteration node is complete, it should wait for the second iteration node, without restarting it ### ❌ Actual Behavior The iterations count restarts in the parallel iteration that was still running when the first one completed
yindo added the 🐞 bugstale🌊 feat:workflow labels 2026-02-21 18:24:03 -05:00
yindo closed this issue 2026-02-21 18:24:03 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 10, 2025):

There is a similar unsolved discussion regarding the issue of not having a choice of parallel in iteration, which might be related to your problem. You can find it here [1].

The issue you're experiencing with the iteration count restarting when running two iteration nodes in parallel in Dify version 0.15.3 is likely due to the way parallel execution is managed in the _run method of the IterationNode class. When one node completes before the other, the queue may receive a RunCompletedEvent or IterationRunFailedEvent, which causes the loop to break and potentially cancel remaining futures, leading to a restart of the iteration count [2].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Feb 10, 2025): <!-- Answer --> There is a similar unsolved discussion regarding the issue of not having a choice of parallel in iteration, which might be related to your problem. You can find it [here](https://github.com/langgenius/dify/discussions/11667) <sup>[[1]](https://github.com/langgenius/dify/discussions/11667)</sup>. The issue you're experiencing with the iteration count restarting when running two iteration nodes in parallel in Dify version 0.15.3 is likely due to the way parallel execution is managed in the `_run` method of the `IterationNode` class. When one node completes before the other, the queue may receive a `RunCompletedEvent` or `IterationRunFailedEvent`, which causes the loop to break and potentially cancel remaining futures, leading to a restart of the iteration count <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/iteration/iteration_node.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/e2ba1401-536f-4652-8946-162848d6cb89?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/e2ba1401-536f-4652-8946-162848d6cb89?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/e2ba1401-536f-4652-8946-162848d6cb89?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/e2ba1401-536f-4652-8946-162848d6cb89?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e2ba1401-536f-4652-8946-162848d6cb89?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/e2ba1401-536f-4652-8946-162848d6cb89?feedback_type=other)</sup>
Author
Owner

@peilinja commented on GitHub (Feb 24, 2025):

0.15.2 happen these fault as well: when the first parallel task completes, the second unfinished task restarts and resent. how to fix it?
the second unfinished task restarts err code:
[Errno 9] File descriptor was closed in another greenlet

@peilinja commented on GitHub (Feb 24, 2025): 0.15.2 happen these fault as well: when the first parallel task completes, the second unfinished task restarts and resent. how to fix it? the second unfinished task restarts err code: [Errno 9] File descriptor was closed in another greenlet
Author
Owner

@peilinja commented on GitHub (Feb 24, 2025):

很奇怪,从云服务版本并行访问两个api每看到未执行完的api重启,到那时docke compose部署的0.15.2和上面老哥一样会出现并行api未执行完会重新restart

@peilinja commented on GitHub (Feb 24, 2025): 很奇怪,从云服务版本并行访问两个api每看到未执行完的api重启,到那时docke compose部署的0.15.2和上面老哥一样会出现并行api未执行完会重新restart
Author
Owner

@heavi715 commented on GitHub (Mar 27, 2025):

有什么解决办法了吗?

@heavi715 commented on GitHub (Mar 27, 2025): 有什么解决办法了吗?
Author
Owner

@heavi715 commented on GitHub (Mar 27, 2025):

0.15.2
api-1 | 2025-03-27 17:33:54,446.446 WARNING [Thread-47818 (_generate_worker)] [ssrf_proxy.py:67] - Request to URL https://openai.cn/v1/chat/completions failed on attempt 1: [Errno 9] File descriptor was closed in another greenlet
api-1 | 2025-03-27 17:33:54,447.447 WARNING [Thread-47818 (_generate_worker)] [node.py:103] - http request node 17429728498230 failed to run: [Errno 9] File descriptor was closed in another greenlet

@heavi715 commented on GitHub (Mar 27, 2025): 0.15.2 api-1 | 2025-03-27 17:33:54,446.446 WARNING [Thread-47818 (_generate_worker)] [ssrf_proxy.py:67] - Request to URL https://openai.cn/v1/chat/completions failed on attempt 1: [Errno 9] File descriptor was closed in another greenlet api-1 | 2025-03-27 17:33:54,447.447 WARNING [Thread-47818 (_generate_worker)] [node.py:103] - http request node 17429728498230 failed to run: [Errno 9] File descriptor was closed in another greenlet
Author
Owner

@laipz8200 commented on GitHub (Mar 31, 2025):

Hi there! Dify is rapidly evolving, and at the moment, we don't have the resources to maintain multiple versions. Version 0.15 will only receive security patches. I recommend upgrading to the latest version to see if the issue still persists.

@laipz8200 commented on GitHub (Mar 31, 2025): Hi there! Dify is rapidly evolving, and at the moment, we don't have the resources to maintain multiple versions. Version 0.15 will only receive security patches. I recommend upgrading to the latest version to see if the issue still persists.
Author
Owner

@DavideDelbianco commented on GitHub (Apr 2, 2025):

I will retry this bug in the latest version and adjust the tagged version if necessary. Parallel execution, the milestone before plugins, suffers for other issues as it can be seen in my most recent reports.

@DavideDelbianco commented on GitHub (Apr 2, 2025): I will retry this bug in the latest version and adjust the tagged version if necessary. Parallel execution, the milestone before plugins, suffers for other issues as it can be seen in my most recent reports.
Author
Owner

@dosubot[bot] commented on GitHub (May 3, 2025):

Hi, @DavideDelbianco. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • A bug in Dify version 0.15.3 causes iteration counts to restart when running two iteration nodes in parallel.
  • Similar issues, including file descriptor errors, were noted in version 0.15.2 by other users.
  • Suggestions were made that the issue might be related to the IterationNode class's management of parallel execution.
  • It was advised to upgrade to the latest version as older versions only receive security patches.
  • You planned to test the bug in the latest version and update the issue.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of Dify. If so, you can keep the discussion open by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (May 3, 2025): Hi, @DavideDelbianco. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - A bug in Dify version 0.15.3 causes iteration counts to restart when running two iteration nodes in parallel. - Similar issues, including file descriptor errors, were noted in version 0.15.2 by other users. - Suggestions were made that the issue might be related to the `IterationNode` class's management of parallel execution. - It was advised to upgrade to the latest version as older versions only receive security patches. - You planned to test the bug in the latest version and update the issue. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of Dify. If so, you can keep the discussion open by commenting here. - If there is no further activity, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8121