Skip to content

Value cannot be null. (Parameter 'responseStream') in DefaultResponseFactory.CreateCoreAsync #151

@latop2604

Description

@latop2604
  • Elastic.Clients.Elasticsearch version: 8.16.0
  • Elasticsearch version: 8.15.3
  • .NET runtime version: 9.x
  • Operating system version: Linux (docker)

We migrated from elastic 6.8 to 8 recently and now we are getting some weird errors randomly.

Value cannot be null. (Parameter 'responseStream')

Stack trace :

Elastic.Transport.UnexpectedTransportException: Value cannot be null. (Parameter 'responseStream')
 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'responseStream')
   at Elastic.Transport.DefaultResponseFactory.CreateCoreAsync[TResponse](Boolean isAsync, Endpoint endpoint, RequestData requestData, PostData postData, Exception ex, Nullable`1 statusCode, Dictionary`2 headers, Stream responseStream, String contentType, Int64 contentLength, IReadOnlyDictionary`2 threadPoolStats, IReadOnlyDictionary`2 tcpStats, CancellationToken cancellationToken)
   at Elastic.Transport.HttpRequestInvoker.RequestCoreAsync[TResponse](Boolean isAsync, Endpoint endpoint, RequestData requestData, PostData postData, CancellationToken cancellationToken)
   at Elastic.Transport.RequestPipeline.CallProductEndpointCoreAsync[TResponse](Boolean isAsync, Endpoint endpoint, RequestData requestData, PostData postData, Auditor auditor, CancellationToken cancellationToken)
   at Elastic.Transport.DistributedTransport`1.RequestCoreAsync[TResponse](Boolean isAsync, EndpointPath path, PostData data, OpenTelemetryData openTelemetryData, IRequestConfiguration localConfiguration, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at Elastic.Transport.DistributedTransport`1.RequestCoreAsync[TResponse](Boolean isAsync, EndpointPath path, PostData data, OpenTelemetryData openTelemetryData, IRequestConfiguration localConfiguration, CancellationToken cancellationToken)

Most of the time it seem to happen on ClearScrollAsync. But some time it happen also on SearchAsync.

We recently created a custom IRequestInvoker that wrap the default one to add some polly retry to fix connection reset by peer. But we are not sure if it's a good idea to include the ArgumentNullException in the retry policy. Any advice would be welcomed.

I don't really know what else to add in the ticket as we are not able to reproduce it on demand.

Ref: #144

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions