Skip to content

Document that request header buffers are retained by the processor cache - #1092

Closed
liotur wants to merge 1 commit into
apache:mainfrom
liotur:bz-69617-header-buffer-retention
Closed

liotur wants to merge 1 commit into
apache:mainfrom
liotur:bz-69617-header-buffer-retention

Conversation

@liotur

@liotur liotur commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

https://bz.apache.org/bugzilla/show_bug.cgi?id=69617

The maxHttpRequestHeaderSize documentation already warns that the full amount
is allocated for every request, but not that the allocation outlives the
requests that caused it. Http11InputBuffer.recycle() leaves the ByteBuffer
in place and only resets its position and limit, so it survives
Http11Processor.recycle() and stays reachable for as long as the processor
sits in the connection handler's recycled processor stack, which is bounded by
processorCache (200 by default). On a keep-alive connection the processor
goes back to that stack between requests as well.

Http11OutputBuffer allocates maxHttpResponseHeaderSize in its constructor
and retains it the same way, and maxHttpHeaderSize provides the default for
both. I kept this change to the attribute the bug is about; happy to add a
matching note under maxHttpResponseHeaderSize if you prefer.

https://bz.apache.org/bugzilla/show_bug.cgi?id=69617

The existing note says that maxHttpRequestHeaderSize is allocated in full
for every request, but not that the allocation outlives the requests that
caused it. Http11InputBuffer.recycle() only resets the position and limit
of the ByteBuffer, and the processor is then pushed back onto the
connection handler's recycled processor stack, so each cached processor
keeps its header buffer for as long as it sits in that cache.
@markt-asf

Copy link
Copy Markdown
Contributor

I applied an alternative update. Dropping the processorCache has significant performance implications. If the docs suggest that, the docs also need to cover the implications. I think drawing attention to the processorCache shoudl be sufficient.

@markt-asf markt-asf closed this Oct 19, 2026
@liotur

liotur commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks — your version covers what I was after.

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