Skip to content

Gflags 解析报错:ERROR: --bthread_concurrency_by_tag must be set on the commandline (default value fails validation) #2542

Description

@yanbinyang

Describe the bug (描述bug)
升级 brpc 1.8.0 后,重复解析两次 gflags 后,flags bthread_concurrency_by_tag validate会报错。

To Reproduce (复现方法)

魔改 echo_c++ 中的 server.cpp

int main(int argc, char* argv[]) {
    // Parse gflags. We recommend you to use gflags as well.
    GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);

    // Parse gflags Again.
    GFLAGS_NS::AllowCommandLineReparsing();
    GFLAGS_NS::SetArgv(argc, (const char**) argv);
    GFLAGS_NS::ReparseCommandLineNonHelpFlags();

    std::string endpoint = "127.0.0.1:8010";
    butil::EndPoint ep;
    str2endpoint(endpoint.c_str(), &ep);
    brpc::Server server;
    EchoServiceImpl echo_svc;
    server.AddService(&echo_svc, brpc::SERVER_DOESNT_OWN_SERVICE);

    server.Start(ep, NULL);

    // Wait until Ctrl-C is pressed, then Stop() and Join() the server.
    server.RunUntilAskedToQuit();
    return 0;
}

Expected behavior (期望行为)
正常启动,但报错ERROR: --bthread_concurrency_by_tag must be set on the commandline (default value fails validation)

Versions (各种版本)
OS: macos/linux
Compiler: g++10.4
brpc: 1.8.0
protobuf: 3.x

Additional context/screenshots (更多上下文/截图)
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions