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

test: more fast-timeouts. #15959

Merged
merged 2 commits into from
Apr 14, 2021
Merged

test: more fast-timeouts. #15959

merged 2 commits into from
Apr 14, 2021

Conversation

alyssawilk
Copy link
Contributor

H2 waitForReset also picks up end stream, while H2 doesn't, so a bunch of QUIC tests
were actually spinning on waitForReset until disconnect happened.

Fixing it and fixing it forward by having a faster timeout which catches if we're waiting for the wrong thing.

Risk Level: n/a
Testing: passes locally at least =P
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <[email protected]>
@alyssawilk alyssawilk requested a review from snowp as a code owner April 13, 2021 21:25
@@ -364,7 +364,7 @@ TEST_P(QuicHttpIntegrationTest, TestDelayedConnectionTeardownTimeoutTrigger) {

ASSERT_TRUE(response->waitForEndStream());
// The delayed close timeout should trigger since client is not closing the connection.
EXPECT_TRUE(codec_client_->waitForDisconnect(std::chrono::milliseconds(5000)));
EXPECT_TRUE(codec_client_->waitForDisconnect(std::chrono::milliseconds(10000)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you decide to increase the timeout here?

@dmitri-d
Copy link
Contributor

lgtm

@@ -69,11 +69,17 @@ AssertionResult IntegrationStreamDecoder::waitForEndStream(std::chrono::millisec
return AssertionSuccess();
}

void IntegrationStreamDecoder::waitForReset() {
AssertionResult IntegrationStreamDecoder::waitForReset(std::chrono::milliseconds timeout) {
Copy link
Contributor

Choose a reason for hiding this comment

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

must use result?

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean ABSL_MUST_USE_RESULT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, seems like we want callers to check this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh, maybe I can on this one - I couldn't on the other one I ported without changing signature, updating envoy filter examples, and then adding MUST_USE but I think Enovy filter examples doens't use this function

if (!saw_reset_) {
Event::TimerPtr timer(dispatcher_.createTimer([this]() -> void { dispatcher_.exit(); }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment on how this works (or this is a common pattern?), it took me a minute. If it is a common pattern, can we extract this to some helper?

Also might want to note somewhere that this leaves the dispatcher in a bad state so you really want ASSERT vs EXPECT

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it leaves the dispatcher in a bad state, what do you think the problem is?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably misunderstanding how this works, but seems to me like this stops the dispatcher after the timer expires? It would then mean that it's no longer running after this? But on the other hand we don't disable this so this will fire on its own at some point anyways, so I guess it can't be messing up the dispatcher. So what exactly does calling dispatcher_.exit() do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, the dispatcher below is run in blocking mode, so it will loop for ever unless something tells it to exit.
Previously, it would exit if reset was received (or disconnect), now it also gives up after 5s.

@yanavlasov
Copy link
Contributor

It is unexpected that waitForReset is triggered when stream ends normally for H2. I wonder if we should make it trigger on resets only or if it could break too many tests.

@yanavlasov yanavlasov self-assigned this Apr 14, 2021
@yanavlasov
Copy link
Contributor

/wait

Signed-off-by: Alyssa Wilk <[email protected]>
Copy link
Contributor

@snowp snowp left a comment

Choose a reason for hiding this comment

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

Thanks!

@alyssawilk alyssawilk merged commit 96573e2 into envoyproxy:main Apr 14, 2021
@alyssawilk
Copy link
Contributor Author

Agree, Yan, it would be good to fix H2 so your waitForX didn't finish if X didn't happen, but I'm going to put off shaving that yak for another day :-)

douglas-reid pushed a commit to douglas-reid/envoy that referenced this pull request Apr 19, 2021
H2 waitForReset also picks up end stream, while H2 doesn't, so a bunch of QUIC tests
were actually spinning on waitForReset until disconnect happened.

Fixing it and fixing it forward by having a faster timeout which catches if we're waiting for the wrong thing.

Risk Level: n/a
Testing: passes locally at least =P
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <[email protected]>
Signed-off-by: Douglas Reid <[email protected]>
Monkeyanator pushed a commit to Monkeyanator/envoy that referenced this pull request Apr 20, 2021
H2 waitForReset also picks up end stream, while H2 doesn't, so a bunch of QUIC tests
were actually spinning on waitForReset until disconnect happened.

Fixing it and fixing it forward by having a faster timeout which catches if we're waiting for the wrong thing.

Risk Level: n/a
Testing: passes locally at least =P
Docs Changes: n/a
Release Notes: n/a

Signed-off-by: Alyssa Wilk <[email protected]>
@alyssawilk alyssawilk deleted the timeout2 branch February 28, 2022 21:25
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.

4 participants