apache / apache/brpc

stream模式下,stream在没有处理rpc response的时候先关闭,导致cntl报错

Open
#2,327 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
17.6k
Forks
4.1k
Avg merge
2d 12h
Merged PRs (30d)
69

Description

**Describe the bug (描述bug)**
1310 void Controller::HandleStreamConnection(Socket *host_socket) {
1311 if (_request_stream == INVALID_STREAM_ID) {
1312 CHECK(!has_remote_stream());
1313 return;
1314 }
1315 SocketUniquePtr ptr;
1316 if (!FailedInline()) {
1317 if (Socket::Address(_request_stream, &ptr) != 0) {
1318 if (!FailedInline()) {
1319 SetFailed(EREQUEST, "Request stream=%" PRIu64 " was closed before responded",
1320 _request_stream);

由于stream的数据是异步交给queue处理的,所以close的frame如果先处理的话,这里是会走到SetFailed的

stub.XXX(&cntl)
if (cntl.Failed())

如果业务这么用的话,cntl.Failed()就会返回真,这个错误可以忽略吗?

从日志看的话,说明作者应该知道这种情况,所以想问下对于使用者来说,cntl.Failed()是否可以不用管,这种情况下继续走下去会有其他隐患吗

Contributor guide

Open the contributing guide

Research direction

Start with Controller::HandleStreamConnection and the reported stub.XXX(&cntl) flow, then trace how stream data and close frames are queued. Reproduce the ordering that sets EREQUEST and determine whether cntl.Failed() is expected to be ignored or indicates unsafe continuation; document or correct the behavior with a focused regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.