Skip to content

Reduce possibility for H2 client count mismatch#8202

Closed
shinrich wants to merge 2 commits intoapache:masterfrom
shinrich:tighten-client-stream-counting
Closed

Reduce possibility for H2 client count mismatch#8202
shinrich wants to merge 2 commits intoapache:masterfrom
shinrich:tighten-client-stream-counting

Conversation

@shinrich
Copy link
Member

@shinrich shinrich commented Aug 3, 2021

Details in issue #8200. The code change pulls up the decrementing logic for the client stream count, so we can be more likely to be consistent with the H2 peers counting.

This closes #8200

@shinrich shinrich added the HTTP/2 label Aug 3, 2021
@shinrich shinrich added this to the 10.0.0 milestone Aug 3, 2021
@shinrich shinrich self-assigned this Aug 3, 2021
@shinrich shinrich requested a review from masaori335 as a code owner August 3, 2021 20:10
@shinrich
Copy link
Member Author

shinrich commented Aug 4, 2021

[approve ci clang-analyzer]

@shinrich
Copy link
Member Author

shinrich commented Aug 5, 2021

[approve ci autest]

@bryancall
Copy link
Contributor

@masaori335 is going to look at it.

if (_state == Http2StreamState::HTTP2_STREAM_STATE_CLOSED && original_state != Http2StreamState::HTTP2_STREAM_STATE_CLOSED) {
Http2ClientSession *h2_proxy_ssn = static_cast<Http2ClientSession *>(this->_proxy_ssn);
SCOPED_MUTEX_LOCK(lock, h2_proxy_ssn->connection_state.mutex, this_ethread());
h2_proxy_ssn->connection_state.decrement_stream_count(this->_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

I can understand we can check state changes here, but I'm not a big fan of giving another task to the Http2Stream::change_state().

@bryancall
Copy link
Contributor

[approve ci]

1 similar comment
@bryancall
Copy link
Contributor

[approve ci]

Copy link
Member

@maskit maskit left a comment

Choose a reason for hiding this comment

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

Decrementing stream count before removing a stream from stream_list sounds dangerous. That could allow keeping a lot of stream instances in the list. I think we should not do it separately at different places.

If I understand the point of this PR correctly, it's decrementing the count as soon as possible when it gets obvious to close a stream. I agree that it would reduce possibility for the count mismatch a little, but I'm not sure if the change helps a lot. I'd try to delete a stream asap if the delay matters.

And it seems like the root cause of the mismatch is a bug in ATS's client code, according to the last comment on #8200. I suggest closing this PR without landing.

@ezelkow1
Copy link
Member

[approve ci rocky]

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.

@github-actions github-actions bot added the Stale label May 20, 2022
@github-actions github-actions bot closed this May 27, 2022
@zwoop zwoop removed this from the 10.0.0 milestone Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Count of concurrent connections diverges between ATS H2 client and ATS H2 server

6 participants