ni / grpc-labview

gRPC client and server support for LabVIEW
MIT License
85 stars 60 forks source link

LabVIEW Crashes when Stopping Two Parallel Running gRPC Servers (on Windows and on NI Linux RT) #361

Closed gmkrtchy closed 2 months ago

gmkrtchy commented 4 months ago

Hi,

We are developing a solution as part of a TBU CCS project that incorporates ni gRPC. In simple terms, we have multiple modules that will have a server setup inside the module & we will be connecting clients from teststand to be able to communicate directly with these modules. These modules will be within a overriding application and running within NI LINUX RT.

We have come across an issue whereby multiple servers is causing NI RT and also Labivew on windows to crash. We do not believe we are doing anything out of the ordinary and we are doing something similar to the TBU SRD ReplayHiLAD RT application, of whcih we can see doesn't do anything "non-standard".

As an example we created one Simple LV project consists of 2 Modules

image image

Both Servers has the same code, after 30 seconds each server generates "Server Stop" event which stops the gRPC Loop. I see that Module1 Server Stops properly, but during stopping Module 2 it loses the connection to the target (See screenshot below)

image image

We are using these versions of gRPC packages image

There looks to be a similar ticket already created here from a partner. Any help and advice on this topic is appreciated as this is a solution required for a key NI Customer Please Find attached the LV Project with Protos gRPC_MultiServer.zip

AB#2759169

nischalks commented 3 months ago

@gmkrtchy, we will look into this issue.

j-medland commented 2 months ago

This is a very rough guess and I am no C++ programmer but is it because LVProtoServerReflectionPlugin is being deleted here?

Looking at how the plugin is instantiated and stored I believe it would be shared between both server instances.

https://github.com/ni/grpc-labview/blob/add68a662437536ee76ecc64cc6a6d469625dea4/src/grpc_server.cc#L273