dify icon indicating copy to clipboard operation
dify copied to clipboard

After clicking to interrupt a Dify session question, the timer still continues

Open luckylybill opened this issue 6 months ago • 1 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

1.4.1

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

Image

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

luckylybill avatar Jun 05 '25 07:06 luckylybill

Hi @luckylybill! I'm Dosu and I’m helping the dify team.

This is a known issue that has persisted across several versions, including 1.4.1. The timer should stop when you interrupt a session, but in some cases it continues because the [ENDTHINKFLAG] signal isn't always sent correctly, which is required for the timer logic to stop counting. There are also gaps in the backend's timer management—specifically, the global timer isn't always cleaned up or cancelled properly when a session is interrupted, so it can keep running in the background even after you click stop [source].

You can try these workarounds: check your .env timeout settings, use the /chat-messages/:task_id/stop endpoint to force-stop a session, and review your model's max_tokens setting to avoid runaway responses [source]. However, a robust fix will likely require changes to how timers are managed in the codebase.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

dosubot[bot] avatar Jun 05 '25 07:06 dosubot[bot]

Currently the reason for this error is that there is only <thinking> and missing of </thinking> due to manual stop. There is no storage for the thinking time, it is just a timer and all happened on enduser's side.

We could have some kind of error handling for this case.

alterxyz avatar Jul 09 '25 07:07 alterxyz