[Bug] streamTimeout 在流式成功结束后未清理 #2

Closed
opened 2026-05-04 22:45:09 +08:00 by admin · 0 comments
Owner

问题描述

AgentChat.vue:411 设置了 60s 超时定时器 streamTimeout。当 SSE 流正常完成时 (reader.read() 返回 done: true,while 循环正常退出),该定时器从未被 clearTimeout 清理。

60s 后回调触发 abortController.abort(),但由于 fetch 已结束,不会造成功能问题。但这属于资源泄漏,如果用户频繁发送消息,可能积累大量未清理的定时器。

涉及文件

frontend/src/views/AgentChat.vue:411-504

修复建议

在 while(true) 循环正常退出后 (第 504 行后),调用 clearTimeout(streamTimeout)。

严重程度

低 - 资源泄漏,无功能影响

## 问题描述 AgentChat.vue:411 设置了 60s 超时定时器 streamTimeout。当 SSE 流正常完成时 (reader.read() 返回 done: true,while 循环正常退出),该定时器从未被 clearTimeout 清理。 60s 后回调触发 abortController.abort(),但由于 fetch 已结束,不会造成功能问题。但这属于资源泄漏,如果用户频繁发送消息,可能积累大量未清理的定时器。 ## 涉及文件 frontend/src/views/AgentChat.vue:411-504 ## 修复建议 在 while(true) 循环正常退出后 (第 504 行后),调用 clearTimeout(streamTimeout)。 ## 严重程度 低 - 资源泄漏,无功能影响
admin self-assigned this 2026-05-04 22:45:09 +08:00
admin closed this issue 2026-05-04 23:56:47 +08:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: admin/aiagent#2