Skip to content

Table size fixes #21

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

Merged
merged 3 commits into from
Dec 20, 2024
Merged

Table size fixes #21

merged 3 commits into from
Dec 20, 2024

Conversation

mtrudel
Copy link
Contributor

@mtrudel mtrudel commented Dec 19, 2024

Fixes #20.

This changes our resize code to always send a dynamic table resize command, even if the table size did not change from the commanded version. This is in line with a closer / alternate read of RFC9113§4.3.1 paragraph 4.

I also fixed the evict_towards_size internal table function to handle the case where it was being asked to evict to a size larger than the table's current actual size. Previously we were always evicting at least one entry even if it wasn't necessary.

(Previously, it would *always* evict at least one record even if
size was <= new_size)
Closer reading of RFC9113§4.3.1para¶4 (https://www.rfc-editor.org/rfc/rfc9113.html#section-4.3.1)
suggests that we should always send a dynamic resize

Fixes elixir-mint#20
@coveralls
Copy link

coveralls commented Dec 19, 2024

Pull Request Test Coverage Report for Build d892f265ddeb6a5729eda4acb9802f149f4728fd-PR-21

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.6%) to 93.939%

Files with Coverage Reduction New Missed Lines %
lib/hpax/table.ex 1 95.92%
Totals Coverage Status
Change from base Build f59c2d8bc52df083bc304e1cd4f6e024736fff28: 0.6%
Covered Lines: 155
Relevant Lines: 165

💛 - Coveralls

@@ -70,7 +70,7 @@ defmodule HPAX.TableTest do
end
end

describe "resizing" do
describe "resize/2" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's not change this, the tests are about the resizing flow

end
end

describe "dynamic_resize/2" do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe "dynamic_resize/2" do
describe "dynamically resizing" do

Comment on lines 274 to 279
table =
if new_protocol_max_table_size < table.size do
evict_to_size(table, new_protocol_max_table_size)
else
table
end
Copy link
Contributor

Choose a reason for hiding this comment

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

This is making my brain hurt 😄 Here, we say to evict the table only if the protocol size goes below the table size. But the added clause to evict_to_size/2 is a no-op if we try to evict to a larger size. These are opposite I think, so it might make sense, but I think some comments would be helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you're right, we don't need this one. I'd had these two commits originally staged in the opposite order so didn't notice that this chunk is now obsolete. Removing.

@mtrudel
Copy link
Contributor Author

mtrudel commented Dec 20, 2024

Updated

@whatyouhide whatyouhide merged commit 761e202 into elixir-mint:main Dec 20, 2024
2 checks passed
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.

NS_ERROR_NET_HTTP2_SENT_GOAWAY errors
3 participants