在运行了大约100个API调用的循环中,出现了ECONNRESET错误和Socket超时错误。在重发API调用后,服务恢复正常。
Bug描述
我正在从Python向Flowise 1.8.3发送2xx个API调用。在macOS上运行一段时间(约10分钟)后,我每隔一段时间(一次ECONNRESET错误和一次Socket超时)就会收到一次ECONNRESET错误和一次Socket超时错误。在重新发送API调用后,服务表现正常。
复现步骤
复现此行为的步骤如下:
在循环中运行一些100个API调用
预期行为
我希望API调用在失败后会自动再次触发。
服务日志
[llm/error] [39m [ [90m1:chain:LLMChain > [1m2:llm:ChatOpenAI [22m [39m] [78.86s] LLM运行出错,错误信息为:“read ECONNRESET\n\nError: read ECONNRESET\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20)”
[chain/error] [39m [ [90m [1m1:chain:LLMChain [22m [39m] [78.87s] Chain运行出错,错误信息为:“read ECONNRESET\n\nError: read ECONNRESET\n at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20)”
2024-07-02 22:03:33 [ERROR]: read ECONNRESET
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:218:20)
2024-07-02 22:03:33 [ERROR]: [server]: Error: Error: read ECONNRESET
Error: Error: read ECONNRESET
at buildFlow (/usr/local/lib/node_modules/flowise/dist/utils/index.js:493:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async utilBuildChatflow (/usr/local/lib/node_modules/flowise/dist/utils/buildChatflow.js:227:36)
at async Object.buildChatflow (/usr/local/lib/node_modules/flowise/dist/services/predictions/index.js:9:28)
at async createPrediction (/usr/local/lib/node_modules/flowise/dist/controllers/predictions/index.js:48:33)
[llm/error] [39m [ [90m1:chain:LLMChain > [1m2:llm:ChatOpenAI [22m [39m] [972.24s] LLM运行出错,错误信息为:“Socket timeout\n\nError: Socket timeout\n at TLSSocket.onTimeout (/usr/local/lib/node_modules/flowise/node_modules/agentkeepalive/lib/agent.js:350:23)\n at TLSSocket.emit (node:events:531:35)\n at Socket._onTimeout (node:net:590:8)\n at listOnTimeout (node:internal/timers:573:17)\n at process.processTimers (node:internal/timers:514:7)”
[chain/error] [39m [ [90m [1m1:chain:LLMChain [22m [39m] [972.24s] Chain运行出错,错误信息为:“Socket timeout\n\nError: Socket timeout\n at TLSSocket.onTimeout (/usr/local/lib/node_modules/flowise/node_modules/agentkeepalive/lib/agent.js:350:23)\n at TLSSocket.emit (node:events:531:35)\n at Socket._onTimeout (node:net:590:8)\n at listOnTimeout (node:internal/timers:573:17)\n at process.processTimers (node:internal/timers:514:7)”
2024-07-02 19:21:06 [ERROR]: Socket timeout
Error: Socket timeout
at TLSSocket.onTimeout (/usr/local/lib/node_modules/flowise/node_modules/agentkeepalive/lib/agent.js:350:23)
at TLSSocket.emit (node:events:531:35)
at Socket._onTimeout (node:net:590:8)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node
3条答案
按热度按时间wd2eg0qa1#
✨✨ 以下内容由 @AsharibAli 使用 Copilot Workspace v0.22 保存
主题
在 ECONNRESET 或 Socket timeout 错误后,API 调用是否会自动重试? 🔄
之前
packages/server/src/utils/buildChatflow.ts
中的代码不包含这些错误的任何重试逻辑。packages/server/src/utils/buildChatflow.ts
的第227行和第493行,类似ECONNRESET和Socket timeout这样的错误会被记录,但不会处理重试。packages/server/src/controllers/predictions/index.ts
中的createPrediction
函数没有为ECONNRESET或Socket timeout错误实现任何重试机制。InternalFlowiseError
,而不重试 API 调用。之后
packages/server/src/utils/buildChatflow.ts
中的utilBuildChatflow
函数中添加了处理ECONNRESET和Socket timeout错误的重试逻辑。packages/server/src/controllers/predictions/index.ts
中的createPrediction
函数中更新了用于处理ECONNRESET和Socket timeout错误的重试逻辑。InternalFlowiseError
。计划
packages/server/src/utils/buildChatflow.ts
(更改)utilBuildChatflow
函数中添加处理ECONNRESET和Socket timeout错误的重试逻辑packages/server/src/controllers/predictions/index.ts
(更改)createPrediction
函数以利用处理ECONNRESET和Socket timeout错误的重试逻辑实现草图
View the changes
详细信息
代码分析于 90558ca
col17t5w2#
这看起来像是SocketIO的问题,我们正在进行更改以使用服务器端事件,希望这能解决该问题。
yvt65v4c3#
这看起来像是SocketIO的问题,我们正在改用服务器端事件,希望能解决这个问题。
好的 @HenryHengZJ ✨