Skip to content

Conversation

@sunng87
Copy link
Contributor

@sunng87 sunng87 commented Feb 21, 2023

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

This change fixes occasional issue with tls handshake. Due to the issue with truncating wrong part of buffer in reader, the rest part of bytes are dropped. Tls stream will end up with invalid partial handshake packet and throws "received corrupt message" error.

Why this only happens on Tls?

Because Tls is the only scenario that client sends two consecutive packets. A normal request-response packet requires reader to read to the end of a packet so it never leaves remaining data.

@sunng87
Copy link
Contributor Author

sunng87 commented Feb 22, 2023

The audit check error is not related to my changes.

@sundy-li
Copy link
Member

sundy-li commented Mar 3, 2023

Oh, there are three places of these codes, but this pr only solves one place?

@sunng87
Copy link
Contributor Author

sunng87 commented Mar 5, 2023

Do you mean the unsafe block? It's not the key issue here. Just because I changed the remaining buffer so the unsafe block in AsyncRead impl can be removed. The usage of truncate is root cause for this bug.

@sundy-li sundy-li requested a review from PsiACE March 9, 2023 07:21
Copy link
Contributor

@PsiACE PsiACE left a comment

Choose a reason for hiding this comment

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

thanks

@PsiACE PsiACE merged commit 4f6400c into databendlabs:main Mar 9, 2023
@sunng87
Copy link
Contributor Author

sunng87 commented Mar 9, 2023

@sundy-li @PsiACE could you cut a release for this? thank you!

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