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

Fix issue where Timeout exception is thrown if error is returned by nats-server before a PONG #522

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brimworks
Copy link
Collaborator

The test case demonstrates the scenario, but here is a quick explanation:

  1. The Options.connectionTimeout() must be set.
  2. The reconnect logic must be triggered.
  3. The nats-server MUST return successfully reconnect and do the INFO/CONNECT request/reply.
  4. The nats-server MUST return an -ERR response BEFORE the PONG. In real-life this would likely be some sort of auth error, but maybe others (like if nats-server is in lame-duck mode?)

When this happens, the reconnect code which waits for a PONG response needs to be interrupted when the connect error gets set.

@scottf
Copy link
Contributor

scottf commented Dec 22, 2021

Am I reading this right, it looks like you just exchanging one exception for another.

@brimworks
Copy link
Collaborator Author

I am not at my computer, but as I recall, we get a different exception AND an artificial delay that is not necessary. This delay is problematic since we need a high connect timeout when a device at the edge is on a congested network. The artificially large delay then occurs almost every time the JWT token expires, and during this time the device appears unreachable from NATS.

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

Successfully merging this pull request may close these issues.

None yet

2 participants