Workflow keeps running after calling stop API, despite receiving success response #13176

Closed
opened 2026-02-21 19:10:54 -05:00 by yindo · 2 comments
Owner

Originally created by @JackIliffe on GitHub (Apr 21, 2025).

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

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Describe the bug
After starting a workflow using the Dify API, I called the /v1/workflow/runs/{id}/stop endpoint to stop it.
The API responded with {"result": "success"}, but the workflow continued running and executing the next steps.

✔️ Expected Behavior

The workflow should stop immediately after the stop API is called, and the status should be updated accordingly (e.g., to stopped or terminated).

Actual Behavior

The API returns a success response, but the workflow continues to run as if nothing happened.

Originally created by @JackIliffe on GitHub (Apr 21, 2025). ### 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 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Describe the bug After starting a workflow using the Dify API, I called the /v1/workflow/runs/{id}/stop endpoint to stop it. The API responded with {"result": "success"}, but the workflow continued running and executing the next steps. ### ✔️ Expected Behavior The workflow should stop immediately after the stop API is called, and the status should be updated accordingly (e.g., to stopped or terminated). ### ❌ Actual Behavior The API returns a success response, but the workflow continues to run as if nothing happened.
yindo added the 🐞 bug🌊 feat:workflow labels 2026-02-21 19:10:54 -05:00
yindo closed this issue 2026-02-21 19:10:54 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 21, 2025):

There are similar threads discussing the issue of workflows continuing to run after calling the stop API. One such thread is titled "Workflow keeps running after calling stop API, despite receiving success response" and is currently open [1]. Another related discussion is "why does workflow keep running in agent?" which is also open [2].

In Dify version 1.1.3, there are known limitations related to stopping workflows, particularly with the inability to forcibly terminate the execution of an iterate node. The iterate node continues running without the ability to break the iteration midway through its execution. The development team plans to implement a Loop node with break functionality in the future [3].

Additionally, when a workflow fails to stop, the specific log or error message generated is "Workflow stopped." This message is part of the NodeRunFailedEvent that is yielded when the workflow is stopped. If an exception occurs, it is logged with the message logger.exception(f"Node {node_instance.node_data.title} run failed") [4].

To continue talking to Dosu, mention @dosu.


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

@dosubot[bot] commented on GitHub (Apr 21, 2025): <!-- Answer --> There are similar threads discussing the issue of workflows continuing to run after calling the stop API. One such thread is titled "Workflow keeps running after calling stop API, despite receiving success response" and is currently open <sup>[[1]](https://github.com/langgenius/dify/discussions/18265)</sup>. Another related discussion is "why does workflow keep running in agent?" which is also open <sup>[[2]](https://github.com/langgenius/dify/discussions/15876)</sup>. In Dify version 1.1.3, there are known limitations related to stopping workflows, particularly with the inability to forcibly terminate the execution of an iterate node. The iterate node continues running without the ability to break the iteration midway through its execution. The development team plans to implement a Loop node with break functionality in the future <sup>[[3]](https://github.com/langgenius/dify/issues/12217)</sup>. Additionally, when a workflow fails to stop, the specific log or error message generated is "Workflow stopped." This message is part of the `NodeRunFailedEvent` that is yielded when the workflow is stopped. If an exception occurs, it is logged with the message `logger.exception(f"Node {node_instance.node_data.title} run failed")` <sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/workflow/graph_engine/graph_engine.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/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/746d297a-545e-48a4-b006-9d40ae1f1902?feedback_type=other)</sup>
Author
Owner

@eviltik commented on GitHub (Dec 30, 2025):

This issue is a blocker for production environments. When using Dify with Ollama (especially with reasoning models like Qwen3 that can hallucinate infinitely in <think> blocks), the inability to actually stop a running workflow leads to:

  1. Resource exhaustion: Ollama continues generating tokens indefinitely, consuming GPU/CPU resources
  2. Poor user experience: Users click "Stop" expecting the generation to halt, but it keeps running in the background
  3. No workaround possible: Since Dify maintains its own HTTP connection to Ollama, external systems cannot interrupt it - only Dify can close that connection

The root cause: When the stop API is called, Dify returns {"result": "success"} but does NOT close the HTTP connection to the LLM provider (Ollama). According to Ollama's behavior, closing the HTTP connection is the signal to stop generation.

Expected behavior: Calling /workflows/tasks/{task_id}/stop should:

  1. Close the HTTP connection to the LLM provider immediately
  2. Actually stop the workflow execution
  3. Update the workflow status to "stopped"

Current behavior: The API returns success but:

  • The HTTP connection to Ollama stays open
  • Ollama keeps generating tokens
  • The workflow continues running

This affects anyone using Dify + Ollama in production, especially with models prone to long reasoning chains. Please prioritize this fix.

Related issues: #6493, #29688, #12798

@eviltik commented on GitHub (Dec 30, 2025): This issue is a **blocker for production environments**. When using Dify with Ollama (especially with reasoning models like Qwen3 that can hallucinate infinitely in `<think>` blocks), the inability to actually stop a running workflow leads to: 1. **Resource exhaustion**: Ollama continues generating tokens indefinitely, consuming GPU/CPU resources 2. **Poor user experience**: Users click "Stop" expecting the generation to halt, but it keeps running in the background 3. **No workaround possible**: Since Dify maintains its own HTTP connection to Ollama, external systems cannot interrupt it - only Dify can close that connection **The root cause**: When the stop API is called, Dify returns `{"result": "success"}` but does NOT close the HTTP connection to the LLM provider (Ollama). According to Ollama's behavior, closing the HTTP connection is the signal to stop generation. **Expected behavior**: Calling `/workflows/tasks/{task_id}/stop` should: 1. Close the HTTP connection to the LLM provider immediately 2. Actually stop the workflow execution 3. Update the workflow status to "stopped" **Current behavior**: The API returns success but: - The HTTP connection to Ollama stays open - Ollama keeps generating tokens - The workflow continues running This affects anyone using Dify + Ollama in production, especially with models prone to long reasoning chains. Please prioritize this fix. Related issues: #6493, #29688, #12798
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13176