Skip to content

http2: transist READY client to busy when SETTING decreases the capacity#18999

Merged
ggreenway merged 3 commits intoenvoyproxy:mainfrom
YaoZengzeng:ready
Nov 17, 2021
Merged

http2: transist READY client to busy when SETTING decreases the capacity#18999
ggreenway merged 3 commits intoenvoyproxy:mainfrom
YaoZengzeng:ready

Conversation

@YaoZengzeng
Copy link
Copy Markdown
Member

Commit Message: http2: transist READY client to busy when SETTING decreases the capacity
Additional Description: fixes part I of #18880
Risk Level: low
Testing: unit
Docs Changes: n/a

Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
@YaoZengzeng
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18999 (comment) was created by @YaoZengzeng.

see: more, trace.

@YaoZengzeng
Copy link
Copy Markdown
Member Author

@alyssawilk PTAL :)

@rojkov
Copy link
Copy Markdown
Member

rojkov commented Nov 15, 2021

/assign @alyssawilk

Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Great fix, thanks! Some comments on the test but the code looks solid :-)

ActiveTestRequest r3(*this, 0, false);
CHECK_STATE(0 /*active*/, 3 /*pending*/, 4 /*capacity*/);

// When the connection connects, there is zero spare capacity in this pool.
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 think you need to update comments?
Before we had max concurrent == 2 and 2 streams, so 0 capacity.
now we have max concurrent == 3 and 3 streams, so 1 capacity left?

cluster_->http2_options_.mutable_max_concurrent_streams()->set_value(4);
ON_CALL(*cluster_, perUpstreamPreconnectRatio).WillByDefault(Return(1));

// One stream results in one connection. Two streams result in two connections.
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.

Also not yours, but I think this comment is from another test and should be removed here (as long as I'm looking at it)b

completeRequest(r1);
EXPECT_EQ(pool_->owningList(Envoy::ConnectionPool::ActiveClient::State::READY).size(), 0);

// Close all streams, concurrency capacity goes to -1, there should be one ready client.
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.

concurrency capacity goes to 1, not -1 right?

completeRequest(r2);
completeRequest(r3);
EXPECT_EQ(pool_->owningList(Envoy::ConnectionPool::ActiveClient::State::READY).size(), 1);
CHECK_STATE(0 /*active*/, 0 /*pending*/, 1 /*capacity*/);
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.

Do you mind creating more streams before doing the close? I think there's value in regression testing that close works when capacity is negative.

Signed-off-by: YaoZengzeng <yaozengzeng@huawei.com>
@YaoZengzeng
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #18999 (comment) was created by @YaoZengzeng.

see: more, trace.

@YaoZengzeng
Copy link
Copy Markdown
Member Author

@alyssawilk updated!

Copy link
Copy Markdown
Contributor

@alyssawilk alyssawilk left a comment

Choose a reason for hiding this comment

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

Awesome, thanks!

Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@ggreenway ggreenway merged commit fe2405a into envoyproxy:main Nov 17, 2021
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