NI gRPC Device Server reports DAQmx event registration errors as events, not as errors
bkeryan opened this issue · comments
The NI gRPC Device Server uses server streaming to return a response for each event generated by DAQmx. However, when a DAQmx event registration function (like DAQmxRegisterDoneEvent) returns an error, the server reports the error by sending a streaming response where response.status
is the error code.
When the rest of the NI gRPC Device Server APIs were updated to report errors by returning a gRPC status, the DAQmx event registration functions were not updated.
Implications:
- It is difficult for clients to synchronously detect whether event registration failed.
- In the success case, no responses are generated until DAQmx notifies the server of an event, so waiting indefinitely for a response only works in the error case.
- Waiting indefinitely for initial metadata does not guarantee that the error will be reported at the same time because the server sends initial metadata before reporting the error.
- Rich error descriptions are not reported for event registration errors, only an error code.
- For done events, a fatal
response.status
is ambiguous: it can mean that event registration failed or that the acquisition/generation encountered an error. - The server does not close the stream when a event registration error occurs, but it will never send any responses other than the one containing the error code.
Addressing this is required to fix nidaqmx-python bug AB#2395958: "GrpcStubInterpreter does not report event registration errors to caller". nidaqmx-python reports event registration errors by raising an exception from the register_done_event
method, not by invoking the event callback. We will have the same problem when supporting gRPC in other versions of the DAQmx API.