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

Early PONG rejection #390

Merged
merged 5 commits into from
Nov 2, 2022
Merged

Early PONG rejection #390

merged 5 commits into from
Nov 2, 2022

Conversation

aricart
Copy link
Member

@aricart aricart commented Oct 25, 2022

[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

…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
@aricart aricart requested a review from kozlovic October 25, 2022 20:31
Copy link
Member

@kozlovic kozlovic left a 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

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

@aricart aricart temporarily deployed to CI November 1, 2022 17:57 Inactive
@aricart aricart temporarily deployed to CI November 1, 2022 18:57 Inactive
@aricart
Copy link
Member Author

aricart commented Nov 1, 2022

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.

Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

README.md Show resolved Hide resolved
@aricart aricart temporarily deployed to CI November 2, 2022 13:33 Inactive
@aricart aricart merged commit 015c030 into main Nov 2, 2022
@aricart aricart deleted the handle-initial-pong-rejection branch November 2, 2022 13:47
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.

3 participants