apache / apache/brpc

BRPC cause pybind embed hang

Open
#2,559 1 comment 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)**

When I use brpc and pybind embed simultaneously and import numpy, the program gets stuck. However, it returns to normal once I remove the include for the brpc header file.

**To Reproduce (复现方法)**

```
#include
#include
#include

namespace py = pybind11;

int main() {
py::scoped_interpreter guard{};

auto sys = py::module_::import("sys");
std::cout << "Python version: " << sys.attr("version").cast() << std::endl;

// auto np = py::module_::import("numpy");
// std::cout << "Numpy version: " << np.attr("__version__").cast() << std::endl;

return 0;
}
```

**Expected behavior (期望行为)**

**Versions (各种版本)**
OS:
Compiler:
brpc:
protobuf:

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

Contributor guide

Open the contributing guide

Research direction

Start with the minimal C++ program in the issue, including brpc/server.h and pybind11/embed.h, then compare importing sys with importing numpy and with the brpc header removed. The issue is resolved when the embedded program imports numpy and exits without hanging; compiler, OS, brpc, and protobuf versions still need to be collected.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, numpy
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.