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

Fixed issues with leafnode compression negotiation #4230

Merged
merged 1 commit into from Jun 10, 2023

Conversation

kozlovic
Copy link
Member

@kozlovic kozlovic commented Jun 9, 2023

When a server would send an asynchronous INFO to a remote server it would incorrectly contain compression information that could cause issues with one side thinking that the connection should be compressed while the other side was not.

It also caused the authentication timer to be incorrectly set which would cause a disconnect.

Signed-off-by: Ivan Kozlovic ijkozlovic@gmail.com

When a server would send an asynchronous INFO to a remote server
it would incorrectly contain compression information that could
cause issues with one side thinking that the connection should
be compressed while the other side was not.

It also caused the authentication timer to be incorrectly set
which would cause a disconnect.

Signed-off-by: Ivan Kozlovic <ijkozlovic@gmail.com>
@kozlovic kozlovic requested a review from a team as a code owner June 9, 2023 19:37
info.Compression = opts.LeafNode.Compression.Mode
// For tests that want to simulate old servers, do not set the compression
// on the INFO protocol if configured with CompressionNotSupported.
if cm := opts.LeafNode.Compression.Mode; cm != CompressionNotSupported {
Copy link
Member

Choose a reason for hiding this comment

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

Is there any value in checking that the proposed compression mode is one we understand?

Copy link
Member Author

@kozlovic kozlovic Jun 9, 2023

Choose a reason for hiding this comment

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

Not sure I understand the question. If it is "are we sure that opts.LeafNode.Compression.Mode is a valid value here?", then yes, it has been already validated on startup (or reload). The point of this test here, is that if we configure as "CompressionNotSupported" (likely in tests), then we don't include the Compression field in the INFO protocol, which makes this server behaves as an old server (protocol wise), since this field won't be set/present in old servers.

Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM - Thanks!

@derekcollison derekcollison merged commit 975f004 into dev Jun 10, 2023
2 checks passed
@derekcollison derekcollison deleted the fix_leafnode_compression_issue branch June 10, 2023 01:20
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

3 participants