Buffer HPACK parsing until the end of a header boundary#26700
Buffer HPACK parsing until the end of a header boundary#26700ctiller merged 17 commits intogrpc:masterfrom
Conversation
HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser.
|
Test changes are usually ill advised to get a change through... so here are some notes on changes I made:
|
|
@nicolasnoble @jtattermusch can you help me with why the tests don't seem to be running here? |
|
Ok, looks like the tests are running again, fixed the last breakage I know of. |
| return {MakeSlice({0x40, 0x0b, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x73, | ||
| 0x74, 0x61, 0x74, 0x75, 0x73, 0x01, 0x30, 0x40, | ||
| 0x0c, 0x67, 0x72, 0x70, 0x63, 0x2d, 0x6d, 0x65, | ||
| 0x73, 0x73, 0x61, 0x67, 0x65, 0x00})}; |
There was a problem hiding this comment.
Side note: this has been broken for years and not doing a correct benchmark: grpc_slice_from_static_string totally stops at the trailing null byte, corrupting the stream.
|
Pinging on this for review |
| "\x00\x00\x00\x04\x01\x00\x00\x00\x00" \ | ||
| "\x00" \ | ||
| "5{\x01\x05\x00\x00\x00\x01" \ | ||
| "\x1aM\x01\x05\x00\x00\x00\x01" \ |
There was a problem hiding this comment.
can you explain this change please?
There was a problem hiding this comment.
The frame length was incorrect, meaning that this test would simply buffer and wait forever due to an incomplete request.
|
Known issues: #24375 |
…)" This reverts commit 8bab3e4.
* Buffer HPACK parsing until the end of a header boundary HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser. * maybe fixes * xx * fix boundary detection * clang-format * Revert "xx" This reverts commit 258d712. * fix tests * add missed check * fixes * fix * update tests * fix benchmark * properly unref * optimize final slice refcounting * cleanup bm_chttp2_hpack * start * new parser progress * refinement * get it compiling * bug-fix * build files * clang-tidy * fixes * fixes * fixes * fix-leaks * clang-tidy * comments * fix merge error * Revert "Buffer HPACK parsing until the end of a header boundary (#26700)" This reverts commit 8bab3e4. * streaming hpack parser start * streaming parser * clang-format * Rework HPackTable into C++ * clang-tidy * fix merge * actually set the size of the entries array * better
* Buffer HPACK parsing until the end of a header boundary HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser. * maybe fixes * xx * fix boundary detection * clang-format * Revert "xx" This reverts commit 258d712. * fix tests * add missed check * fixes * fix * update tests * fix benchmark * properly unref * optimize final slice refcounting * cleanup bm_chttp2_hpack * start * new parser progress * refinement * get it compiling * bug-fix * build files * clang-tidy * fixes * fixes * fixes * fix-leaks * clang-tidy * comments * fix merge error * Revert "Buffer HPACK parsing until the end of a header boundary (grpc#26700)" This reverts commit 8bab3e4. * streaming hpack parser start * streaming parser * clang-format * Rework HPackTable into C++ * clang-tidy * fix merge * actually set the size of the entries array * better
…#26700)" (grpc#26825) This reverts commit 8bab3e4.
* Buffer HPACK parsing until the end of a header boundary HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser. * maybe fixes * xx * fix boundary detection * clang-format * Revert "xx" This reverts commit 258d712. * fix tests * add missed check * fixes * fix * update tests * fix benchmark * properly unref * optimize final slice refcounting * cleanup bm_chttp2_hpack * start * new parser progress * refinement * get it compiling * bug-fix * build files * clang-tidy * fixes * fixes * fixes * fix-leaks * clang-tidy * comments * fix merge error * Revert "Buffer HPACK parsing until the end of a header boundary (grpc#26700)" This reverts commit 8bab3e4. * streaming hpack parser start * streaming parser * clang-format * Rework HPackTable into C++ * clang-tidy * fix merge * actually set the size of the entries array * better
HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser.
…#26700)" (grpc#26825) This reverts commit 8bab3e4.
* Buffer HPACK parsing until the end of a header boundary HTTP2 headers are sent in (potentially) many frames, but all must be sent sequentially with no traffic intervening. This was not clear when I wrote the HPACK parser, and still indeed quite contentious on the HTTP2 mailing lists. Now that matter is well settled (years ago!) take advantage of the fact by delaying parsing until all bytes are available. A future change will leverage this to avoid having to store and verify partial parse state, completely eliminating indirect calls within the parser. * maybe fixes * xx * fix boundary detection * clang-format * Revert "xx" This reverts commit 258d712. * fix tests * add missed check * fixes * fix * update tests * fix benchmark * properly unref * optimize final slice refcounting * cleanup bm_chttp2_hpack * start * new parser progress * refinement * get it compiling * bug-fix * build files * clang-tidy * fixes * fixes * fixes * fix-leaks * clang-tidy * comments * fix merge error * Revert "Buffer HPACK parsing until the end of a header boundary (grpc#26700)" This reverts commit 8bab3e4. * streaming hpack parser start * streaming parser * clang-format * Rework HPackTable into C++ * clang-tidy * fix merge * actually set the size of the entries array * better
HTTP2 headers are sent in (potentially) many frames, but all must be
sent sequentially with no traffic intervening.
This was not clear when I wrote the HPACK parser, and still indeed quite
contentious on the HTTP2 mailing lists.
Now that matter is well settled (years ago!) take advantage of the fact
by delaying parsing until all bytes are available.
A future change will leverage this to avoid having to store and verify
partial parse state, completely eliminating indirect calls within the
parser.