Why bRPC allows several bthreads keep running until process quit and without join them?
- Dominant language
- C++
- Stars
- 17.6k
- Forks
- 4.1k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 69
Description
**Describe the bug (描述bug)**
Like dumping_thread in bvar, naming_services_thread in loadbalancewithnaming, why bRPC allows them keep running until process quit without join them, it should be very risky that when process is quitting, that some variables has been destroyed but these bthreads is keeping reading or writing them, which will cause some cores.
**To Reproduce (复现方法)**
E.g. set gflags: bvar_dump to true, which will result in start the bvar's dumping_thread and keep running until the process quit, that a segment fault core will occur because some gflags the dumping_thread keep reading are destroyed by gflags when process quit but dumping_thread still keep reading them, dumping_thread is not joined before process quit.
**Expected behavior (期望行为)**
dumping_thread should be joined before process quit.
**Versions (各种版本)**
OS:
Compiler:
brpc:
protobuf:
**Additional context/screenshots (更多上下文/截图)**
Contributor guide
Research direction
Start by tracing the bvar_dump path to dumping_thread and inspect naming_services_thread in loadbalancewithnaming, focusing on their shutdown and lifetime handling. Reproduce process shutdown with bvar_dump enabled, then verify that these bthreads stop or are joined before the variables and gflags they access are destroyed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100