NageNalock commented on issue #1120:
URL: https://github.com/apache/incubator-brpc/issues/1120#issuecomment-700414190
我这里还有其他问题.
当设置 event_dispatcher_num 等于 num_threads 时, 在代码中使用 channel 去请求后台 http_server,
会发不出去请求
brpc 接口代码
```c++
void Echo(google::protobuf::RpcController* cntl_base,
const HttpRequest*,
HttpResponse*,
google::protobuf::Closure* done) {
// This object helps you to call done->Run() in RAII style. If you
need
// to process the request asynchronously, pass done_guard.release().
brpc::ClosureGuard done_guard(done);
brpc::Controller* cntl =
static_cast<brpc::Controller*>(cntl_base);
butil::IOBufBuilder os;
// Fill response.
cntl->http_response().set_content_type("text/plain");
brpc::Controller c_cntl;
c_cntl.http_request().uri() = url;
c_cntl.http_request().set_method(brpc::HTTP_METHOD_POST);
c_cntl.request_attachment().append(cntl->request_attachment());
channel.CallMethod(NULL, &c_cntl, NULL, NULL, NULL);
if (c_cntl.Failed()) {
std::cerr << c_cntl.ErrorText() << std::endl;
os << c_cntl.ErrorText() << '\n';
cntl->SetFailed(c_cntl.ErrorText());
} else {
// os << "queries:";
for (brpc::URI::QueryIterator it =
cntl->http_request().uri().QueryBegin();
it != cntl->http_request().uri().QueryEnd(); ++it) {
os << ' ' << it->first << '=' << it->second;
}
os << c_cntl.response_attachment() << '\n';
}
os.move_to(cntl->response_attachment());
}
```
brpc启动命令(第一个参数是后台 server 接口)
```shell
./router_server xxx.xxx.xxx.xx:20002/echo -num_threads=24
-event_dispatcher_num=12
```
使用 curl 测试. 请求被阻塞住了, 经过抓包, brpc 没有发出 http 请求

当设置 num_threads 数量大于 event_dispatcher_num 时, 无该现象, 可正常收发请求
```shell
./router_server xxx.xxx.xxx.xx:20002/echo -num_threads=24
-event_dispatcher_num=12
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]