# gRPC with UE4

**URL:** <https://forums.unrealengine.com/t/grpc-with-ue4/152693>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [October 26, 2020, 3:00am UTC](https://forums.unrealengine.com/t/grpc-with-ue4/152693 "2020-10-26T03:00:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bo0olean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bo0olean/32/464984_2.png) [@bo0olean](https://forums.unrealengine.com/u/bo0olean)\
**Post date:** [October 26, 2020, 3:00am UTC](https://forums.unrealengine.com/t/grpc-with-ue4/152693/1 "2020-10-26T03:00:50Z")

</div>

Hi,

I’m new to gRPC and UE C++. I’m trying to create a gRPC server on UE4 and connect it to a remote client.

I first tried [GitHub - adamrehn/ue4-grpc-demo: Dockerised Unreal Engine 4 microservice demo using gRPC](https://github.com/adamrehn/ue4-grpc-demo) without the docker part and was able to make it work with small modifications. Now, I’m trying to port the [GrpcServiceImp.h](https://github.com/adamrehn/ue4-grpc-demo/tree/master/server/CubePhysicsDemo/Source/CubePhysicsDemo/Public) & it’s .cpp part into a Plugin. However, once ported to a plugin, engine is crashing when I try to send commands from a python client. The trace was something like this

```auto

<CALLSTACK START>
grpc_impl::internal::RpcMethodHandler<PawnMovementDemo::Service, Direction, Empty>::D
https:\/\/forums.unrealengine.com\/core\/image\/gif;base64
​eserialize(grpc_call*, grpc_byte_buffer*, grpc::Status*, void**) Address = 0x174ee7926 ~/.local/include/grpcpp/impl/codegen/method_handler_impl.h, line 99] [in UE4Editor-MyPlugin-0021.dylib]
grpc_impl::Server::SyncRequest::CallData::Run(std::__1::shared_ptr<grpc_impl::Server::GlobalCallbacks> const&, bool) Address = 0x1753e9966 (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc_impl::Server::SyncRequestThreadManager::D
https:\/\/forums.unrealengine.com\/core\/image\/gif;base64
​oWork(void*, bool, bool) Address = 0x1753e880b (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc::ThreadManager::MainWorkLoop() Address = 0x175424101 (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc::ThreadManager::WorkerThread::Run() Address = 0x175423dec (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc::ThreadManager::WorkerThread::WorkerThread(grpc::ThreadManager*)::$_0::o
https:\/\/forums.unrealengine.com\/core\/image\/gif;base64
​perator()(void*) const Address = 0x17542507c (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc::ThreadManager::WorkerThread::WorkerThread(grpc::ThreadManager*)::$_0::__invoke(void*) Address = 0x175425055 (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc_core::(
https:\/\/forums.unrealengine.com\/core\/image\/gif;base64
​perator()(void*) const Address = 0x1759537ef (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
grpc_core::(
https:\/\/forums.unrealengine.com\/core\/image\/gif;base64
​anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)::'lambda'(void*)::__invoke(void*) Address = 0x1759536e5 (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
_pthread_start Address = 0x7fff73926109 (filename not found) [in libsystem_pthread.dylib]
thread_start Address = 0x7fff73921b8b (filename not found) [in libsystem_pthread.dylib]
<CALLSTACK END>

```

Initially I had the gRPC dependencies in my project’s .build.cs. Now, I’ve included the same dependencies in the Plugin’s .build.cs and removed it from the project’s .build.cs. This is static linkage of gRPC libraries.

The .uplugin part contains

```auto

"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "",
"Description": "",
"Category": "Other",
"CreatedBy": "",
"CreatedByURL": "",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": true,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": false,
"Modules": 
{
"Name": "MyPlugin",
"Type": "Runtime",
"LoadingPhase": "Default"
}
]

```

and I’ve added the dependency of the Plugin module in the project’s .build.cs.

I’m creating the server during BeginPlay(). Also, I tried different LoadingPhase for the Plugin module - PreDefault, Default, PostDefault and none of them worked.

The functionality is failing not when I start the game, but when I send my first message from the client. For me, it looks like some thread issue - one thread is not able to communicate to another? I’m not sure. I’m unable to understand what is causing this issue. Any help that could direct me towards potential problems would be helpful!

Thanks in advance!

Cheers!

---

<div class="post-metadata">

**Author:** ![bgrbeiyi](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bgrbeiyi](https://forums.unrealengine.com/u/bgrbeiyi)\
**Post date:** [July 21, 2022, 3:28am UTC](https://forums.unrealengine.com/t/grpc-with-ue4/152693/2 "2022-07-21T03:28:49Z")

</div>

hello,Solved?
