Announcement

Collapse
No announcement yet.

gRPC with UE4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    gRPC with UE4

    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 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 & 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

    Code:
    <CALLSTACK START>
    grpc_impl::internal::RpcMethodHandler<PawnMovementDemo::Service, Direction, Empty>::D​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​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​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::(​anonymous namespace)::ThreadInternalsPosix::ThreadInternalsPosix(char const*, void (*)(void*), void*, bool*, grpc_core::Thread::Options const&)::'lambda'(void*)::o​perator()(void*) const Address = 0x1759537ef (filename not found) [in UE4Editor-ConanUE4-7613.dylib]
    grpc_core::(​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

    Code:
    "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!
    Last edited by bo0olean; 10-26-2020, 12:19 AM.
Working...
X