ni / grpc-labview

gRPC client and server support for LabVIEW
MIT License
88 stars 62 forks source link

Each gRPC client call logs "ERROR: THIS POINTER IS NOT REGISTERED" #270

Closed bkeryan closed 1 year ago

bkeryan commented 1 year ago

Bug Report

If you build a measurement service into an EXE and statically register it with the MeasurementLink discovery service, it logs "ERROR: THIS POINTER IS NOT REGISTERED".

This error comes from https://github.com/ni/grpc-labview/blob/master/src/pointer_manager.h

It is looking up the client context from contextId. This parameter is optional, so leaving it unwired should not log errors.

    labview_grpc_server.dll!grpc_labview::PointerManager<grpc_labview::gRPCid>::TryCastTo<grpc_labview::ClientContext>(grpc_labview::gRPCid * ptr, int * status) Line 75    C++
    labview_grpc_server.dll!grpc_labview::gRPCid::CastTo<grpc_labview::ClientContext>() Line 43 C++
>   labview_grpc_server.dll!ClientUnaryCall(grpc_labview::gRPCid * clientId, int * occurrence, const char * methodName, const char * requestMessageName, const char * responseMessageName, char * requestCluster, grpc_labview::gRPCid * * callId, int timeoutMs, grpc_labview::gRPCid * contextId) Line 277    C++
    000001b5208f61b4()  Unknown
    LabVIEW.exe!DoCaughtExtFuncCall(long(*)(DSHeader *) funcPtr, DSHeader * dsp) Line 109   C++
    LabVIEW.exe!ExtFuncWrapper(long(*)(DSHeader *) funcPtr, void * pSetTLSIndex, long bExcludeTryCatch, DSHeader * dsp, long qeOffset) Line 241 C++
    000001b5208f50fe()  Unknown

Repro or Code Sample

Build MeasurementLink example measurements into EXEs. Copy the build output to C:\ProgramData\National Instruments\MeasurementLink\Services Run the measures in InstrumentStudio. Look at C:\ProgramData\National Instruments\MeasurementLink\Logs\DiscoveryService.txt

Expected Behavior

Does not log unexpected errors.

Current Behavior

Logs unexpected errors:

===== 06/14/2023 14:46:03 ===== Information: Launching service "UI Progress Updates (LabVIEW)" at path: "C:\ProgramData\National Instruments\MeasurementLink\Services\UI Progress Updates\UI Progress Updates.exe"
===== 06/14/2023 14:46:05 ===== Information: "UI Progress Updates (LabVIEW)": "Server listening on localhost:0"
===== 06/14/2023 14:46:05 ===== Information: "UI Progress Updates (LabVIEW)": "ERROR: THIS POINTER IS NOT REGISTERED"
===== 06/14/2023 14:46:05 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/ResolveService" responded 200 in 1863.6233 ms
===== 06/14/2023 14:46:05 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/RegisterService" responded 200 in 1.1826 ms
===== 06/14/2023 14:46:05 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/ResolveService" responded 200 in 0.1295 ms
===== 06/14/2023 14:46:37 ===== Information: Launching service "NI-DCPower Source DC Voltage (LabVIEW)" at path: "C:\ProgramData\National Instruments\MeasurementLink\Services\NI-DCPower Measurement\NI-DCPowerMeasurement.exe"
===== 06/14/2023 14:46:38 ===== Information: "NI-DCPower Source DC Voltage (LabVIEW)": "Server listening on localhost:0"
===== 06/14/2023 14:46:38 ===== Information: "NI-DCPower Source DC Voltage (LabVIEW)": "ERROR: THIS POINTER IS NOT REGISTERED"
===== 06/14/2023 14:46:38 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/ResolveService" responded 200 in 1895.3099 ms
===== 06/14/2023 14:46:38 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/RegisterService" responded 200 in 1.0880 ms
===== 06/14/2023 14:46:39 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/ResolveService" responded 200 in 0.0981 ms
===== 06/14/2023 14:46:39 ===== Information: "PinMapService": "[14:46:39 INF] HTTP POST /ni.measurementlink.pinmap.v1.PinMapService/UpdatePinMapFromXml responded 200 in 24.2984 ms"
===== 06/14/2023 14:46:39 ===== Information: "PinMapService": "[14:46:39 INF] HTTP POST /ni.measurementlink.pinmap.v1.PinMapService/QueryPins responded 200 in 0.2363 ms"
===== 06/14/2023 14:46:39 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/ResolveService" responded 200 in 0.0848 ms
===== 06/14/2023 14:46:41 ===== Information: "NI-DCPower Source DC Voltage (LabVIEW)": "ERROR: THIS POINTER IS NOT REGISTERED"
===== 06/14/2023 14:46:41 ===== Information: HTTP "POST" "/ni.measurementlink.discovery.v1.DiscoveryService/ResolveService" responded 200 in 0.0845 ms
===== 06/14/2023 14:46:41 ===== Information: "NI-DCPower Source DC Voltage (LabVIEW)": "ERROR: THIS POINTER IS NOT REGISTERED"
===== 06/14/2023 14:46:41 ===== Information: Launching service "NI gRPC Device Server" at path: "C:\Program Files\National Instruments\Shared\MeasurementLink\Services\gRPC Device Server Activation\NationalInstruments.MeasurementLink.GrpcDeviceServerActivationService.exe"
===== 06/14/2023 14:46:42 ===== Information: "NI-DCPower Source DC Voltage (LabVIEW)": "ERROR: THIS POINTER IS NOT REGISTERED"

Context

Testing a new example MeasurementLink service

Your Environment

AB#2427675

twaltersp commented 1 year ago

We are seeing the same bug in the ADAS offering. We are not doing anything with ML but if we create a client on RT that connects to the server (also on RT) we get this printed to the screen. The client and server still seem to function correctly.

twaltersp commented 1 year ago

@ni-sujain Is there a planned next build/release that will include this fix?
FYI @gaoruhao

ni-sujain commented 1 year ago

@twaltersp We will be doing a release for oneof datatype support in some days. This fix might come along with that release