-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Elastic.Clients.Elasticsearch version: 8.15.6
Elasticsearch version: 8.16
.NET runtime version: 8
Operating system version: linux
Description of the problem including expected versus actual behavior:
A clear and concise description of what the bug is.
When calling response.DebugInformation after configuring ConnectionSettings with .DisableDirectStreaming() and .EnableDebugMode(), the application throws a System.OutOfMemoryException.
It appears that the StringBuilder.ToString() call inside ElasticsearchResponse.get_DebugInformation() allocates excessive memory, possibly due to large request/response payloads or logs. This results in a crash instead of returning debug information as expected.
Steps to reproduce:
- Configure the client using:
(ElasticsearchClientSettings settings)
settings
.DisableDirectStreaming()
.EnableDebugMode()
.PrettyJson(); - Execute a request expected to generate a large debug log (e.g., bulk insert or large query).
- Access response.DebugInformation
Expected behavior
A clear and concise description of what you expected to happen.
Accessing response.DebugInformation should return helpful debug output or at minimum handle large payloads gracefully without throwing OutOfMemoryException. Ideally, large content should be truncated, streamed, or otherwise managed to prevent memory exhaustion.
Provide ConnectionSettings
(if relevant):
Provide DebugInformation
(if relevant):
Unavailable due to OutOfMemoryException being thrown when accessing response.DebugInformation.