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

Option to not disconnect on Auth/TLS errors #586

Closed
cbrake opened this issue Aug 17, 2020 · 2 comments
Closed

Option to not disconnect on Auth/TLS errors #586

cbrake opened this issue Aug 17, 2020 · 2 comments
Labels
feature New feature request

Comments

@cbrake
Copy link
Contributor

cbrake commented Aug 17, 2020

Feature Request

Provide option to not disconnect on Auth/TLS errors. The auth case has been discussed before:

#499 (comment)

I'm also see this on TLS failures (CLIFF statements are instrumentation I added to the nats.go package):

CLIFF: connect
CLIFF: processConnectInit
CLIFF: sendConnect returned:  nats: expected 'PONG', got ''
CLIFF: processConnectInit returned:  nats: expected 'PONG', got ''
CLIFF: 1
CLIFF: close()
NATS: TLS required:  true
2020/08/17 11:32:54 Nats started
CLIFF: doReconnect
CLIFF: 2
CLIFF: close()
2020/08/17 11:32:54 NATS Disconnected!
2020/08/17 11:32:54 Connection to NATS is closed! -- this should never happen, waiting 15m then exitting

Increasing the TLS Timeout on the server fixes the above issue. With IoT devices on cellular networks, this can be problematic because the connection is not always reliable, and can get quite slow at times.

Use Case:

For IoT devices running the NATS client, we would like to keep the *nats.Conn object for the entire lifecycle of the application, as it might be doing other things like running rules, controlling things, etc. Recreating the nats connection requires us to re-setup subscriptions, etc.

Proposed Change:

Provide an option to not disconnect on TLS or Auth failures.

Who Benefits From The Change(s)?

People implementing IoT clients where NATS is our only access to the device -- we can't easily restart more like a microservice.

Alternative Approaches

Perhaps provide a way we can initiate a re-connect without creating a new nats.Conn -- this would allows us to manage the reconnection manually.

@cbrake cbrake added the feature New feature request label Aug 17, 2020
@ripienaar
Copy link
Contributor

Are we 100% sure that TLS errors would also be considered auth errors. This seems like a significant problem with this behaviour then :(

@kozlovic
Copy link
Member

The TLS error was due to a bug fixed in #587.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

3 participants