-
Notifications
You must be signed in to change notification settings - Fork 53
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
Early PONG rejection #390
Early PONG rejection #390
Conversation
…in some difficult scenarios in node for the pong to be rejected before other handlers are setup. See https://github.com/nats-io/nats.js/issues/523 [LINT] fixed some linter and fmt warnings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -217,6 +217,9 @@ export class ProtocolHandler implements Dispatcher<ParserEvent> { | |||
this.resetOutbound(); | |||
|
|||
const pong = deferred<void>(); | |||
pong.catch(() => { | |||
// provide at least one catch - as pong rejection can happen before it is expected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about a log warning about such errors, or better make it properly awaited? There's no guarantee that it will always fail with an "ok" error. If some exception happens, it will be swallowed here, which will make debugging quite a challenge
…nect error when it closed the client.
Added some additional guardrails, depending on the runtime the type of error returned will be different. But in cases where the client was telegraphing the PONG rejection, the disconnect error will not have a trace, as that trace is bogus, the client simply disconnected. With that said in node, the errors are properly reported now, but that is a different PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[FIX] added a catch to the initial pong promise as it seems possible in some difficult scenarios in node for the pong to be rejected before other handlers are setup. See https://github.com/nats-io/nats.js/issues/523
[LINT] fixed some linter and fmt warnings