Skip to content

Conversation

@zero4197
Copy link

issues地址:#2496

backend/domain/plugin/internal/dal/model/agent_tool_draft.gen.go第149-180行GetAll()函数中。
使用分页的逻辑来查询工具,分页的游标为ID,但是在select语句中,没有加上ID这个参数,导致只要是数据达到20,该分页的for循环就会陷入死循环。opencoze和mysql的cpu会激增最终导致系统死机。

修复:
在getSelected中加上ID选择

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


maozh seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mrh997
Copy link
Collaborator

mrh997 commented Nov 20, 2025

在 getSelected 里加比较隐式,全局搜下 order ,直接加 Select(ID) 好一些。
image

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...end/domain/plugin/internal/dal/agent_tool_draft.go 0.00% 2 Missing ⚠️
Files with missing lines Coverage Δ
...end/domain/plugin/internal/dal/agent_tool_draft.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zero4197
Copy link
Author

在 getSelected 里加比较隐式,全局搜下 order ,直接加 Select(ID) 好一些。 image

getSelcted只给这个位置使用了。有opt的时候就会增加字段。 如果opt为nil的话,就是查全部了。 还不能Select里面加。
我改的方式也有问题,没有考虑opt为nil的情况。应该这么改
image

@mrh997
Copy link
Collaborator

mrh997 commented Nov 21, 2025

@zero4197 还有几个设计了 getSelcted 的地方,麻烦辛苦一起改下吧

@zero4197
Copy link
Author

@zero4197 还有几个设计了 getSelcted 的地方,麻烦辛苦一起改下吧

总共有7个,部分有用ID当游标来分页的,部分没有,为防止后面上游再使用ID当游标分页,只要是opt!=nil的,我统一都加上了查询ID字段。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants