okhttp: optimize HPACK to index :path and fix dynamic table eviction - #1
Open
skrcode wants to merge 2 commits into
Open
okhttp: optimize HPACK to index :path and fix dynamic table eviction#1skrcode wants to merge 2 commits into
skrcode wants to merge 2 commits into
Conversation
…bugs (grpc#12819) Allow the :path pseudo-header to be added to the HPACK dynamic table in the gRPC-Java OkHttp transport, resolving the original goal of grpc#12819 and redoing reverted commit 397d3e7 (grpc#12799, grpc#12820). Background & Root Cause: In gRPC over HTTP/2, :path headers represent static service/method names (e.g., /package.Service/Method), which are constant across RPC calls. Previously, indexing :path was reverted (grpc#12820) because high dynamic table churn uncovered latent bugs in legacy OkHttp Hpack.java: 1. Off-by-one NPE loop bound in evictToRecoverBytes: When bytesToRecover exceeded total dynamic table size, the loop condition (j >= nextDynamicTableIndex) inspected the unallocated nextDynamicTableIndex slot containing null, throwing a NullPointerException. Fixed by changing the loop bound to (j > nextDynamicTableIndex). 2. Reference leak post-eviction: System.arraycopy shifted active entries rightward, but left stale Header/ByteString references in vacated array slots. Fixed by setting vacated array slots to null via Arrays.fill(). 3. Case sensitivity normalization: Header entries inserted into dynamicTable are now guaranteed to store lowercased name keys, preventing failed dynamic table header lookups. 4. Table Size Setting Handling: Works in conjunction with grpc#12818 (SETTINGS_HEADER_TABLE_SIZE handling). Fixes grpc#12819 Related: grpc#12799, grpc#12818, grpc#12820, b/514688016
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JAIPilot evaluation mirror of grpc#12907.
d0272ef78f4e78983cb1f19ac25d1561ec26cc1bThis mirror preserves the contributor tree exactly. Any JAIPilot result should appear as a separate draft companion PR; this is not an upstream submission.