Description
Observed behavior
When calling natsConnection_Request()
that results in a Not Permitted
error, the error status is not returned from the natsConnection_Request()
method. Instead, the Not Permitted
status is sent to the callback assigned in natsOptions_SetErrorHandler()
. The request method completes with a status of Timeout
several seconds after the error callback.
This makes it impossible to tie the error to the request.
An alternative way to do this would be to match the subscription subject in the error callback to the replyID of the request natsMsg
handed to the natsConnection_Request()
method, but neither of these are populated. The subscription in the callback is empty, and the request given to the request method is also empty when the method times out.
Expected behavior
Ideally, the natsStatus
would be returned from the natsConnection_Request()
method and it would complete as soon as the error is received.
Server and client version
nats-server: v2.10.3
nats.c client: v3.7.0
Host environment
Client is on various configurations of iPhone hardware and iOS version (recent).
Steps to reproduce
- Set up a callback with
natsOptions_SetErrorHandler()
and log the info returned - Set up a Nats server that returns a
Not Permitted
error to requests - Set up
natsConnection_Request()
to log the returned status and request - Call
natsConnection_Request()
with a timeout - The error callback will return with an empty subscription struct first
- The request will complete only after the timeout without the underlying
Not Permitted
status