Skip to content

HeapBufferedAsyncResponseConsumer does not limit heap memory usage for chunked responses #105684

Open

Description

org.elasticsearch.client.HeapBufferedAsyncResponseConsumer imposes a limit (default 100MiB) on the size of responses it'll accept. However this limit only applies to responses with a Content-length header, and therefore does not restrict the heap memory usage when receiving a response with Transfer-encoding: chunked. These days pretty much all large responses are chunked so in practice this limit doesn't really do anything any more. Should we fix it to apply to all responses so as to protect clients from OOMEs? At the very least we should probably mention this anomaly in our docs somewhere.


Workaround

Use org.elasticsearch.client.RequestOptions.Builder#setHttpAsyncResponseConsumerFactory to provide a response consumer which does handle chunked responses correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions