Skip to content

test: more fast-timeouts.#15959

Merged
alyssawilk merged 2 commits intoenvoyproxy:mainfrom
alyssawilk:timeout2
Apr 14, 2021
Merged

test: more fast-timeouts.#15959
alyssawilk merged 2 commits intoenvoyproxy:mainfrom
alyssawilk:timeout2

Conversation

@alyssawilk
Copy link
Copy Markdown
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 <alyssar@chromium.org>
@alyssawilk alyssawilk requested a review from snowp as a code owner April 13, 2021 21:25
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
Copy Markdown
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
Copy Markdown
Contributor

lgtm

}

void IntegrationStreamDecoder::waitForReset() {
AssertionResult IntegrationStreamDecoder::waitForReset(std::chrono::milliseconds timeout) {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

void IntegrationStreamDecoder::waitForReset() {
AssertionResult IntegrationStreamDecoder::waitForReset(std::chrono::milliseconds timeout) {
if (!saw_reset_) {
Event::TimerPtr timer(dispatcher_.createTimer([this]() -> void { dispatcher_.exit(); }));
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

/wait

Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Copy link
Copy Markdown
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
Copy Markdown
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 <alyssar@chromium.org>
Signed-off-by: Douglas Reid <douglas-reid@users.noreply.github.com>
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 <alyssar@chromium.org>
@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