mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[PR #1132] [MERGED] 使用长prompt时,避免rpc进程挂掉 #1565
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#1565
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/ktransformers/pull/1132
Author: @wangkuigang-yewu-cmss
Created: 4/13/2025
Status: ✅ Merged
Merged: 4/13/2025
Merged by: @qiyuxinlin
Base:
main← Head:long-prompt-crash📝 Commits (1)
4538bdaprevent rpc process from crashing on long prompt📊 Changes
1 file changed (+4 additions, -0 deletions)
View changed files
📝
ktransformers/server/backend/interfaces/balance_serve.py(+4 -0)📄 Description
当prompt超过cache_len的时候,rpc进程会crash掉,导致整体不可用。
这里增加一个检查,让过长的prompt在请求早期就被提前过滤掉。
在使用超过cache_len的长prompt时,rpc进程会在这里挂掉:
gdb输出
挂掉位置的代码,以及相关变量如截图所示:
用torch申请的内存使用
estimated_length,而实际prompt为query_length,比申请到的更大,所以会直接挂掉。这个提交做了一个简单的规避。抛出异常后,连接会被立即关闭(具体行为是,响应了200+headers后,连接被立即关闭)
并且由于抛出异常的位置query还没开始处理,所以不会影响后续请求。
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.