-
Notifications
You must be signed in to change notification settings - Fork 17
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(torture): handle large overflow values #711
Conversation
4ce9f87
to
4639fd5
Compare
597a922
to
3a5180f
Compare
Workarounds is fine, but please please please, leave a note in the code explaining what they are doing. If you don't do it, the next generation of maintainers (that might include yourself), will definitely get the "wtf is this shit" question, and they will try to remove this code, only to uncover this is for a reason. Another option is that some of us will remember that this is some workaround, but will not remember why, and as such will be reluctant to remove this workaround even when it's not needed. I do not care about this particular case that much, I care about us aligning on the common approach writing and documenting code. |
You are totally right! I really thought I had added the same text both in the pr description and in the code! |
4639fd5
to
1a1eb3c
Compare
3a5180f
to
0fd1f96
Compare
0fd1f96
to
9ebcf8d
Compare
Spawning a blocking task to handle the reception of the message is a workaround to make it possible to handle large overflow values.
Using the standard
timeout(self.shared.timeout, rx).await??;
does not work, it hangs when the expected value to be received is larger than 15KiB.The problem seems to be strictly related to the interaction between
tokio::time::timeout
andtokio::sync::oneshot::Receiver
.A simple code like the following perfectly works.
It seems that the
Future
implementation oftokio::sync::oneshot::Receiver
switches from being non-blocking to blocking if the size of the message gets bigger than 15KiB.But I also found this, which is a bug within the timeout function in a couple of versions ago (solved in 1.38.1, we are in 1.42), maybe it is not entirely solved.