How to force gRPC cpp program using single thread only


March 2019


29 time


I need to run my client application (written in c++ with gRPC) in an operating system (which only support single thread). However, I noticed that grpc::InsecureChannelCredentials(); is trying to create multiple threads. Here is the output from debugger after calling that gRPC function in my host machine:

[New Thread 0x7ffff524a700 (LWP 3709)]
[New Thread 0x7ffff524a700 (LWP 3710)]
[New Thread 0x7ffff524a700 (LWP 3711)]

This will cause the program crash inside the single thread OS.

My question is: is there a way to configure gPRC using only single thread, or make cpp executable run only with single thread? Thanks in advance.

btw, here is the link to the os mentioned above and the issue explains why it only support single thread.

EDIT: It's actually not allowing multi-process instead of multi-thread applicaiton. gRPC seems like doing fork inside its core lib. I'm wondering if there is a way to configure gRPC to disable process forking.


0 answers