zwoop commented on code in PR #13420:
URL: https://github.com/apache/trafficserver/pull/13420#discussion_r3648230387
##########
src/proxy/http2/Http2ConnectionState.cc:
##########
@@ -2472,9 +2487,11 @@ Http2ConnectionState::send_headers_frame(Http2Stream
*stream)
http2_convert_header_from_1_1_to_2(send_hdr);
}
- uint32_t buf_len = send_hdr->length_get() * 2; // Make it double just
in case
- ts::LocalBuffer local_buffer(buf_len);
- uint8_t *buf = local_buffer.data();
+ uint32_t buf_len = send_hdr->length_get() * 2; // Make it double just in case
+ // Keep typical header sets off the heap; oversized ones spill to it.
+ static_assert(HdrHeap::DEFAULT_SIZE * 2 <= 8192, "keep HEADERS encode stack
buffer within the event-thread stack budget");
+ ts::LocalBuffer<uint8_t, HdrHeap::DEFAULT_SIZE * 2> local_buffer(buf_len);
+ uint8_t *buf =
local_buffer.data();
Review Comment:
no, it's setting the local (stack) buffer to 2x the default header heap
size. So, for the "common" case, where things (hopefully) would have fit in a
freelist header_heap, it now stays on the stack. The assert it to assure that
future changes to the header_heap default size doesn't blow the stack
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]