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

[QUIC] Improve idle timeout tests #73228

Merged
merged 4 commits into from
Aug 8, 2022
Merged

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Aug 2, 2022

Noticed the test when looking into other stuff. The original test did not set idle timeout and so it took long time to run. I also added a check for the right exception from a QuicStream

@ghost
Copy link

ghost commented Aug 2, 2022

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Noticed the test when looking into other stuff. The original test did not set idle timeout and so it took long time to run. I also added a check for the right exception from a QuicStream

Author: rzikm
Assignees: -
Labels:

area-System.Net.Quic

Milestone: -

await clientStream.WriteAsync(new byte[1]);
using QuicStream serverStream = await serverConnection.AcceptInboundStreamAsync();

var acceptTask = serverConnection.AcceptInboundStreamAsync();
Copy link
Member

Choose a reason for hiding this comment

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

Nit: var => the actual type

var acceptTask = serverConnection.AcceptInboundStreamAsync();

// Wait for idle timeout
await Task.Delay(TimeSpan.FromSeconds(10));
Copy link
Member

Choose a reason for hiding this comment

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

Does it need to be 10 seconds? Can we decrease both the idle timeout and this value?

Copy link
Member Author

Choose a reason for hiding this comment

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

We probably can, we might not even need this delay (it will block and wait on the next assert).

What timeout would you think appropriate? 1s? I did not want to have it too low to avoid flakiness on CI.

Copy link
Member

Choose a reason for hiding this comment

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

Can we write the test in a way that's more resilient? For example, issue a read against the stream, time how long it takes for it to fail, and then validate the time is within some acceptable range?

Copy link
Member Author

@rzikm rzikm Aug 2, 2022

Choose a reason for hiding this comment

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

I don't see how that makes the test more resilient... The way I see it we care about the QuicErrorCode thrown in the QuicException, not necessarily about the precision of the timing (which is difficult enough since we don't know when MsQuic will actually send/receive the packets

Copy link
Member

@stephentoub stephentoub Aug 2, 2022

Choose a reason for hiding this comment

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

It's a combination of resiliency and how much time we're willing to spend in CI. The way you have it written, you're forced to choose a large value that makes the test take much longer in hopes that it'll be long enough to catch any flakiness in CI. The way I suggested, you don't have to choose a time to wait at all; you simply wait for the read to complete, validate it threw the expected exception, and validate that the time it took to complete was within some acceptable range. Basically, I'm not sure what purpose this Task.Delay is serving, only to make the test take longer.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm not sure what purpose this Task.Delay is serving

I noted above that the delay can be removed, the test can wait/block on the asserts that follow so that there is no unnecessary delay. My question was more about how long do you think the IdleTimeout value should be.

Copy link
Member

Choose a reason for hiding this comment

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

Ok. I think it should be short, like 1 second, unless there's something about a short timeout that makes that problematic.

@rzikm
Copy link
Member Author

rzikm commented Aug 4, 2022

Test failures are unrelated

@rzikm rzikm requested a review from a team August 5, 2022 07:30
Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

Thanks.

@rzikm
Copy link
Member Author

rzikm commented Aug 8, 2022

Test failure is probably dotnet/arcade#9009

@rzikm rzikm merged commit d63c65d into dotnet:main Aug 8, 2022
@karelz karelz added this to the 7.0.0 milestone Aug 15, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants