apache / apache/servicecomb-java-chassis

ProviderQpsFlowControlHandler不被执行的问题

Open
#4,646 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.9k
Forks
814
Avg merge
8d 23h
Merged PRs (30d)
1

Description

当请求走到doInvoke时
![image](https://github.com/user-attachments/assets/62a9b16f-1c9a-4d3b-826d-46e14338df5b)
由于在外部进行了++,导致handlerIndex已经是1了
![image](https://github.com/user-attachments/assets/5aec9dd6-68d8-422d-82c3-5a1b9c895909)
此时放在handlerList中的首个是ProviderQpsFlowControlHandler
![image](https://github.com/user-attachments/assets/02fc7631-27fa-4bc1-9ff1-18607c62c50e)
它的首行会判断invocation的hanlerIndex是否大于0,由于handlerIndex++放在入口前,且handlerIndex不能赋值初始值为-1,也没有其他途径修改值,所以进来这里的代码一定是大于0的,导致ProviderQpsFlowControlHandler可能永远不被执行
![image](https://github.com/user-attachments/assets/52bac518-b087-4c7c-aeb8-ee835bc25235)

我在走读代码的时候看到了这么个情况,绞尽脑子没有想到缘由,可能不是bug,而是有什么其他设计,希望能够得到解答,万分感谢!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at doInvoke and trace how invocation.handlerIndex changes before ProviderQpsFlowControlHandler is reached. Read the handlerList ordering and the handler's initial handlerIndex check, then confirm whether the handler is skipped in this path. Done means documenting the intended design or producing a focused fix with evidence that the handler executes correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.