Giter VIP home page Giter VIP logo

trpc-cpp's People

Contributors

bochencwx avatar chhy2009 avatar helloopenworld avatar hzlushiliang avatar iutx avatar lioncfliu avatar liucf3995 avatar newbieorange avatar peggiezhu avatar raychen911 avatar weimch avatar yanyupeng2018 avatar ypingcn avatar yujun411522 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

trpc-cpp's Issues

compile trpc-cpp on centos 7.9 failed

ERROR: /root/.cache/bazel/_bazel_root/de3aeab5343b6e0969660d47054e8920/external/com_github_google_flatbuffers/BUILD.bazel:30:1: no such target '@platforms//os:openbsd': target 'openbsd' not declared in package 'os' (did you mean 'freebsd'?) defined by /root/.cache/bazel/_bazel_root/de3aeab5343b6e0969660d47054e8920/external/platforms/os/BUILD and referenced by '@com_github_google_flatbuffers//:platform_openbsd'
ERROR: Analysis of target '//trpc/util/flatbuffers:trpc_fbs' failed; build aborted: Analysis failed

加密与鉴权

trpc协议是怎么支持消息的加密与鉴权的,通过filter来实现的话,那不是会在filter阶段多进行一次数据的反序列化?

Fiber能否支持阻塞调用

例如go语言中协程是支持同步的系统调用阻塞当前协程的,Fiber后续是否会支持类似的特性。

使用vscode调试如何配置gflags参数?

使用命令行启动程序, 通过gflags指定参数正常 ./helloworld_svr --config=../conf/trpc_cpp_fiber.yaml
但是如果使用vscode进程调试

示例中HelloWorldServer是继承自TrpcApp, gflags参数

DEFINE_string(config, "trpc_cpp_default.yaml", "trpc cpp framework config file");

默认值是trpc_cpp_default.yaml, 我在程序的运行目录放置一个trpc_cpp_default.yaml文件,运行报错
start server with config, for example: /xxx/build/helloworld_svr --config=default.yaml, 看了代码逻辑

  if (google::GetCommandLineFlagInfo("config", &info) && info.is_default) {
    std::cerr << "start server with config, for example: " << argv[0] << " --config=default.yaml" << std::endl;
    exit(-1);
  }

这里好像又不让使用默认值?

The return value from io_uring_submit is not being handled correctly.

Hi, developers !
I want to try tRPC in my project, one that uses io_uring with SQ_POLL.
However, I noticed a small mistake in async_io.cc when handling the return value of io_uring_submit().
When using SQ_POLL, io_uring_submit() may return a higher number of submitted entries than actually submitted

On success io_uring_submit(3) returns the number of submitted
submission queue entries, if SQPOLL is not used. If SQPOLL is
used, the return value may report a higher number of submitted
entries than actually submitted
. If the the user requires
accurate information about how many submission queue entries have
been successfully submitted, while using SQPOLL, the user must
fall back to repeatedly submitting a single submission queue
entry. On failure it returns -errno.
from:https://man7.org/linux/man-pages/man3/io_uring_submit.3.html

// trpc/runtime/iomodel/async_io/async_io.cc
// SubmitOne:
  int ret = io_uring_submit(ring);
  if (TRPC_UNLIKELY(ret != 1)) {
    trpc::object_pool::Delete<IOURingUserData>(user_data);
    if (ret < 0) {
      return MakeExceptionFuture<int32_t>(AsyncIOError(ret));
    }
    std::string msg = "Submit success but return not one, ret:" + std::to_string(ret);
    return MakeExceptionFuture<int32_t>(AsyncIOError(AsyncIOError::SUBMIT_FAIL, msg));
  }
  submitted_++;

  return user_data->pr.GetFuture();

Therefore, in the case of using SQ_POLL, ret != 1 may not indicate a submission failure.

ref:
https://man7.org/linux/man-pages/man3/io_uring_submit.3.html
axboe/liburing#88
axboe/liburing#966

tencentOS Server relealse 3.1 编译失败

ERROR: /home/lichard/trpc-cpp/trpc/tracing/BUILD:19:11: Compiling trpc/tracing/tracing_factory.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 39 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
gcc: error: trpc/tracing/tracing_factory.cc: Permission denied
gcc: fatal error: no input files
compilation terminated.

代码组织优化

cpp下,example里的hellowrld示例,greeter_service.cc,如果有多个请求协议处理时,如存在SayHellow1, SayHellow2, ...SayHellow10时,这个greeter_service.cc就变得很臃肿,有没有好的办法可以拆分,如果用多个.cc来实现greeter_service.h的定义,又破坏了cpp的文件结构;如果使用一个SayHellow一个service的注册方式,在conf配置里又存在多个service配置的臃肿问题,框架现在 又不支持同名service_name的多个service实例的注册。这里应该有优化的空间吧

road_map

trpc-cli还准备开源么,有没有类似road_map的开源计划或版本更新计划的,现在用着有点懵
这些没有的话就打算自己撸了,或者有没有交流群的

调用链路的唯一ID

/// @brief Get the unique id of the current request.
uint32_t GetRequestId() const { return invoke_info_.seq_id; }

这个seq_id是调用的唯一ID么,这里看到框架是通过请求的request_id设置的,而且只是一个uint32_t, 这里怎么保证seq_id是全局唯一的呢
context->SetRequestId(req->req_header.request_id());

这里应该 是使用一个uuid,或用雪花算法类的ID吧

日志打印是否能支持链路追踪

后台部署有多个server,当一个请求链路存在server1->server2->server3时
此时在三个server上的日志,是否能支持有类似msg_id的标志,可以更加方便地追踪到请求的处理链路
就是框架在请求里自动添加msg_id,logger打印日志时直接根据日志 format配置在每行日志添加msg_id打印

执行run_client.sh出现无法访问的问题

使用trpc生成桩代码,然后执行./run_client.sh出现了如下报错
Starting local Bazel server and connecting to it...
INFO: Repository trpc_cpp instantiated at:
/home/huangfu/common/trpc-cpp/examples/try/forward/WORKSPACE:2:15: in
Repository rule git_repository defined at:
/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git.bzl:181:33: in
ERROR: An error occurred during the fetch of repository 'trpc_cpp':
Traceback (most recent call last):
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git.bzl", line 175, column 35, in _git_repository_implementation
update = _clone_or_update_repo(ctx)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, column 20, in clone_or_update_repo
git
= git_repo(ctx, directory)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, column 12, in git_repo
_update(ctx, git_repo)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 109, column 10, in _update
fetch(ctx, git_repo)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 152, column 15, in fetch
_error(ctx.name, ["git"] + args, st.stderr)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 200, column 9, in _error
fail("error running '%s' while working with @%s:\n%s" % (command_text, name, stderr))
Error in fail: error running 'git fetch origin master:origin/master' while working with @trpc_cpp:
fatal: 无法访问 'https://git.woa.com/trpc-cpp/open-source/trpc-cpp.git/':The requested URL returned error: 403
ERROR: /home/huangfu/common/trpc-cpp/examples/try/forward/WORKSPACE:2:15: fetching git_repository rule //external:trpc_cpp: Traceback (most recent call last):
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git.bzl", line 175, column 35, in _git_repository_implementation
update = _clone_or_update_repo(ctx)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git.bzl", line 36, column 20, in clone_or_update_repo
git
= git_repo(ctx, directory)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 91, column 12, in git_repo
_update(ctx, git_repo)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 109, column 10, in _update
fetch(ctx, git_repo)
File "/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 152, column 15, in fetch
_error(ctx.name, ["git"] + args, st.stderr)
File “/home/huangfu/.cache/bazel/_bazel_huangfu/895430b3b0095088170b48818227c861/external/bazel_tools/tools/build_defs/repo/git_worker.bzl", line 200, column 9, in _error
fail("error running '%s' while working with @%s:\n%s" % (command_text, name, stderr))
Error in fail: error running 'git fetch origin master:origin/master' while working with @trpc_cpp:
fatal: 无法访问 'https://git.woa.com/trpc-cpp/open-source/trpc-cpp.git/':The requested URL returned error: 403
ERROR: Error computing the main repository mapping: no such package '@trpc_cpp//trpc': error running 'git fetch origin master:origin/master' while working with @trpc_cpp:
fatal: 无法访问 'https://git.woa.com/trpc-cpp/open-source/trpc-cpp.git/':The requested URL returned error: 403
Loading:

然后,我访问了https://git.woa.com/trpc-cpp/open-source/trpc-cpp.git/ 这个网站,出现了如下图示,用微信扫码也无法访问。
image

本人为初学者,正在上手,麻烦您解答下,非常感谢!

redis请求的上下文id是怎么关联的 貌似没有找到

  1. bool FiberTcpConnComplexConnector::MessageHandleFunction(const ConnectionPtr& conn, std::dequestd::any& rsp_list) {

  2. bool conn_reusable = true;

  3. for (auto&& rsp_buf : rsp_list) {

  4. ProtocolPtr rsp_protocol;
    
  5. bool ret = options_.trans_info->rsp_decode_function(std::move(rsp_buf), rsp_protocol);
    
  6. if (TRPC_LIKELY(ret)) {
    
  7.   TRPC_ASSERT(rsp_protocol);
    
  8.   conn_reusable &= rsp_protocol->IsConnectionReusable();
    
  9.   uint32_t id = 0;
    
  10.   rsp_protocol->GetRequestId(id);
    
  11.   auto ctx = call_map_->TryReclaimContext(id);   **// redis协议如何恢复这个上下文 貌似reqid再redis协议中没有透传逻辑**
    
  12.   if (TRPC_UNLIKELY(ctx.Get() == nullptr)) {
    
  13.     // The request corresponding to the response cannot be found,
    
  14.     // and the request may have timed out, so it will not be processed
    
  15.     TRPC_LOG_WARN("can not find request, request_id: " << id << ", maybe timeout");
    
  16.     continue;
    
  17. }

  18.   if (ctx->backup_request_retry_info == nullptr) {
    
  19.     ctx->rsp_msg->msg = std::move(rsp_protocol);
    
  20.     DispatchResponse(std::move(ctx));
    
  21.   } else {
    
  22.     if (!ctx->backup_request_retry_info->retry->IsReplyReady()) {
    
  23.       ctx->rsp_msg->msg = std::move(rsp_protocol);
    
  24.       DispatchResponse(std::move(ctx));
    
  25.     } else {
    
  26.       TRPC_LOG_WARN("Get response late when retry, if too many this log, consider a bigger retry delay");
    
  27.       DispatchException(std::move(ctx), TrpcRetCode::TRPC_INVOKE_UNKNOWN_ERR, "");
    
  28.     }
    
  29.   }
    
  30. } else {
    
  31.   conn_reusable = false;
    
  32.   break;
    
  33. }
    
  34. }

  35. return conn_reusable;

  36. }
    如以上代码11行的疑问 麻烦解答下 谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.