redis 认证机制在重试策略下存在问题/controller中 auth flag存在的意义?
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
**Describe the bug (描述bug)**
发生rpc重试时,socket的auth状态与pipline的auth状态有可能不一致。
模式:连接池
**To Reproduce (复现方法)**
在连接池模式下,若发起redis请求后失败需要重试(如tcp 连接超时 connect time out),此时有可能出现controller已被置FLAGS_REQUEST_WITH_AUTH标志位(pip line依赖此标志位),而从池中拿出的socket已认证过无需auth的情况,从而导致解包失败,出现认证失败的错误( "Redis Auth failed: " )。
代码位置:

发生重试时,若此处auth为NULL(取出的socket已认证),controller的标志位未清除,从而导致pipline的标志位出错。

这里的疑问是,为什么需要一个这样的标志位?为什么redis的认证不能与socket保持一致?
即:
wopt.with_auth = _auth;
希望能够得到解答。
**Expected behavior (期望行为)**
redis的pipline中的auth状态应与socket保持一致,而非controller。
**Versions (各种版本)**
OS:
Compiler:
brpc:
protobuf:
**Additional context/screenshots (更多上下文/截图)**
Contributor guide
Research direction
Start by tracing the controller, pipeline, and socket authentication state during a connection-pool retry, focusing on the FLAGS_REQUEST_WITH_AUTH path described in the issue. Reproduce a failed request followed by a retry and verify that pipeline authentication follows the socket state without producing a Redis Auth failed error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, redis
- Domain
- backend-api-design, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100