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

fix(netbench): correctly handle stream shutdown in duplex #1898

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

camshaft
Copy link
Contributor

@camshaft camshaft commented Aug 8, 2023

Description of changes:

After merging #1883, the s2n-tls netbench driver has been consistently failing on the ping test. Digging in a bit deeper on it, it looks like the Duplex driver wasn't correctly handling cases where the stream shut down and it got into an infinite loop.

This change fixes the receive to handle all of the error cases correctly.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@camshaft camshaft marked this pull request as ready for review August 8, 2023 18:32
@camshaft camshaft requested a review from goatgoose August 8, 2023 18:32
@@ -125,22 +125,31 @@ impl<T: AsyncRead + AsyncWrite> super::Connection for Connection<T> {

match self.inner.as_mut().poll_read(cx, &mut buf) {
Poll::Ready(_) => {
if buf.filled().is_empty() && self.stream_opened {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main issue seems to be coming from the fact that we're checking && self.stream_opened here. If this poll_receive function is called after it's closed, then we will never exit from the loop

@camshaft camshaft merged commit bddeb95 into main Aug 8, 2023
128 of 129 checks passed
@camshaft camshaft deleted the camshaft/netbench-duplex-fix branch August 8, 2023 22:49
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.

2 participants