dify icon indicating copy to clipboard operation
dify copied to clipboard

When the conversation is interrupted by the page being closed, the large model gets stuck in an endless loop.

Open v-49 opened this issue 9 months ago • 6 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [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

Image When the conversation is interrupted by the page being closed, the large model gets stuck in an endless loop.

how to reproduce it: open it on the explore; Send a question and then interrupt it when he is about to start by directly closing the page.

✔️ Expected Behavior

There is a timeout period; at least the large model won't run indefinitely like this; but in fact, the best situation is that after it is closed on the page, it can output normally, and at least the complete end can be seen in the log.

❌ Actual Behavior

llm endless running seem choked up

v-49 avatar Mar 27 '25 08:03 v-49

I couldn't find specific information on how Dify handles the lifecycle of a conversation when the page is closed abruptly or how it manages interruptions in the conversation workflow. However, there are mechanisms in place to handle interruptions or timeouts for long-running tasks, such as retry on failure, error handling, and environment configuration for managing timeouts [1].

Additionally, you might want to check the environment variables related to timeouts in your .env file, such as SSRF_DEFAULT_TIME_OUT, HTTP_REQUEST_MAX_CONNECT_TIMEOUT, and others, to ensure they are set appropriately to prevent the model from running indefinitely [2].

I found a similar unsolved discussion titled "What if my task keeps running and can't stop" that might be related to your issue [3].

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] avatar Mar 27 '25 08:03 dosubot[bot]

this bug is can be reproduced

v-49 avatar Mar 27 '25 08:03 v-49

I also experienced LLM being in a running state, calling the API interface of the dify application through C # to output. Sometimes, the output would continue to run halfway through

RicardoMrLin avatar Apr 09 '25 00:04 RicardoMrLin

any one can help? Even the latest version(1.2.0) also exists this issue.

zhangever avatar Apr 23 '25 01:04 zhangever

this bug is can be reproduced

How? I have the same issue. But I don't know how to reproduce it.

zhangever avatar Apr 23 '25 01:04 zhangever

I encountered the same problem, and it happens consistently. Does anyone understand this issue?

13241308289 avatar Apr 24 '25 08:04 13241308289

The load balancing code may cause these issues in some scenarios. code is here.

I have only encountered this once, where the HTTP status 429 fills up the entire log. Perhaps defining a maximum loop counter variable to prevent this from happening could be a solution. @crazywoola

huayaoyue6 avatar Jun 28 '25 15:06 huayaoyue6

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

Issue Summary:

  • You reported that interrupting a large model conversation by closing the page causes an endless loop instead of proper timeout or termination in Dify v0.15.3 (Docker).
  • Other users have confirmed similar behavior persists in later versions like 1.2.0.
  • I suggested that load balancing code might cause repeated HTTP 429 errors, potentially leading to the loop.
  • I proposed a mitigation involving adding a maximum loop counter to prevent infinite retries.
  • Existing timeout environment variables and related discussions exist, but no definitive fix has been implemented yet.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify by commenting here to keep the discussion open.
  • Otherwise, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Sep 01 '25 16:09 dosubot[bot]