Skip to content

okhttp: optimize HPACK to index :path and fix dynamic table eviction - #1

Open
skrcode wants to merge 2 commits into
masterfrom
jaipilot-demo/grpc-12907
Open

okhttp: optimize HPACK to index :path and fix dynamic table eviction#1
skrcode wants to merge 2 commits into
masterfrom
jaipilot-demo/grpc-12907

Conversation

@skrcode

@skrcode skrcode commented Aug 22, 2026

Copy link
Copy Markdown
Owner

JAIPilot evaluation mirror of grpc#12907.

This mirror preserves the contributor tree exactly. Any JAIPilot result should appear as a separate draft companion PR; this is not an upstream submission.

…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
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.

2 participants