Skip to content

bvar IntRecorder引起segfault #3065

Description

@Yangfisher1

为了breakdown性能引入了bvar IntRecorder
bvar::IntRecorder g_latency_recorder("xxxx");
在向这个recorder写入数据的时候发生segfault,
g_latency_recorder << xxx;

通过gdb bt检查发现是IntRecorder的_combiner成员为空, 检查代码后发现只有这样创建IntRecorder时才会初始化_combiner, 否则是不会初始化的
bvar::IntRecorder g_latency_recorder;

    IntRecorder() : _combiner(std::make_shared<combiner_type>()), _sampler(NULL) {}

    explicit IntRecorder(const butil::StringPiece& name) : _sampler(NULL) {
        expose(name);
    }

    IntRecorder(const butil::StringPiece& prefix, const butil::StringPiece& name)
        : _sampler(NULL) {
        expose_as(prefix, name);
    }

请问一下这里剩下两个构造函数不初始化_combiner是什么原因呢, 是有专门的设计还是只是写漏了?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions