Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request returns error status on callback, rather than from the method itself #740

Open
jakeobrien opened this issue Mar 26, 2024 · 0 comments
Assignees
Labels
defect Suspected defect such as a bug or regression

Comments

@jakeobrien
Copy link

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
@jakeobrien jakeobrien added the defect Suspected defect such as a bug or regression label Mar 26, 2024
@levb levb self-assigned this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

2 participants