Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
latop2604 opened this issue Dec 20, 2024 · 3 comments

Comments

@latop2604
Copy link

latop2604 commented Dec 20, 2024

  • 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

@latop2604
Copy link
Author

latop2604 commented Dec 20, 2024

Hum, seem to be fixed in 1bd2db0

Is it safe to update Elastic.Transport nuget without updating Elastic.Clients.Elasticsearch ?

@latop2604
Copy link
Author

Just found that Elastic.Clients.Elasticsearch 8.16.3 include the ElasticTransport fix. I'll try that.

@flobernd
Copy link
Member

@latop2604 Let us know if the 8.16.3 version solves your issue 🙂

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

No branches or pull requests

2 participants