apache / apache/brpc

为什么代码方式关闭不了bvar sampling线程?

Open
#2,244 9 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)**
如何用代码的方式关闭sampling 线程?

**To Reproduce (复现方法)**
namespace bvar {
namespace detai {
DECLARE_bool(bvar_enable_sampling);
}
}

int main () {
bvar::detail::FLAGS_bvar_enable_sampling = false;
return 0;
}

**Expected behavior (期望行为)**
关闭bvar的sampling线程。

**Versions (各种版本)**
OS:
Linux c1089df56064 4.9.70-040970-generic #201712161132 SMP Sat Dec 16 16:33:52 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Compiler:
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

brpc: 1.4.0
protobuf: protobuf-3.19.5

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

:W20230511 18:29:16.687115 87 sampler.cpp:194] bvar is busy at sampling for 2 seconds!

Contributor guide

Open the contributing guide

Research direction

Start at sampler.cpp:194 and trace the bvar_enable_sampling flag and sampling-thread entry points mentioned in the issue. Reproduce the reported two-second sampling warning, then determine whether the requested programmatic shutdown behavior is supported; done means the behavior is addressed or clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.